Answer the question
In order to leave comments, you need to log in
How to properly set up a redirect after authorization?
The authorization token is stored in LocalStorage. Further in the editor, the flag is changed to true and React itself decides whether to redirect or render the component.
const isAuth = useSelector(state => state.user.auth)
return isAuth ? <Redirect to='/user' /> : <Component />
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question