Great tutorial! Just wondering how do you redirect the user to an (authenticated) url? Because if I use useHistory().push('/auth'); in the button click it won't work as the state is still false.
I am a Software Engineer and Developer Advocate who loves sharing knowledge via writing, videos, mentorship, and working out. Please Subscribe: https://www.youtube.com/channel/UCcz5Bvr4kGHPFAjvnRhIQ4g
Great tutorial! Just wondering how do you redirect the user to an (authenticated) url? Because if I use
useHistory().push('/auth');
in the button click it won't work as the state is still false.I will be going in detail on this in the next article. It will be out next week.
Meanwhile, you can use cookies to make the Auth token available in all of your pages. Then use token to make the API call
We also have the concept of protected routes in React where only authenticated users can access such routes.