Current landing page URL after login - 'www.website.com'. But I want it to be redirected to "www.website.com/home" upon login. So it has to be redirected to home component.
CodePudding user response:
you could simply redirect "/" to "/home"
CodePudding user response:
Maybe you can just change your path from "/" to "/home"?
CodePudding user response:
If you have a solution to check if the user is log you can do that
<Route exact path="/">
{loggedIn ? <Redirect to="/home" /> : <LoginPage />}
</Route>
If not, you need to redirect to '/home' after login directly after the function of log (in the .then() if you'r loginAction is promise or just after login function). With React Router v5 : history.push('/home') With React Router v6 : navigate('/home') See the doc of React Router if you need more explanation.