Accepted answer

Looks like this is a bug:, and possibly even a React bug:

For now, you can get around it by rendering Router and your context provider in separate components. Like this, for example:

const Routes = () => (
  <UserContext.Provider value={false}>
          <ProtectedRoute path='/protected' component={Protected}/>
          <Route path='/login' component={Login}/>

export default class App extends Component {
    render() {
        return (

Related Query

More Query from same tag