I have this code:
BrowserRouter
Switch
Redirect from="/" exact to={verificarLogueo ? "/dashboard" : "/login"} /
Route exact path="/login" component={Login} /
Route exact path="/dashboard" component={Dashboard} /
/Switch
/BrowserRouter
How to redirect at my Dashboard Component after Login using Router when verificarLogueo change the value at true?
Top comments (2)
HowtoRedirectAfterLogin
Add history.push("/dashboard") when login action returns success