score:1

Accepted answer
state = {
  isAuthenticated: false,
}

//in render : 

return (
  <div>
    <Router history={history}>
      <Switch>
        <Route exact path="/login" render={(props) => ((this.state.isAuthenticated) ? <Home {...props}/> : <Login {...props}/>)}/>
        <Route exact path="/" render={(props) => ((this.state.isAuthenticated) ? <Home {...props}/> : <Login {...props}/>)}/>
      </Switch>
    </Router>
  </div>
);

Related Query

More Query from same tag