Question:
I want to check for cookies every time a user gets redirected to a different Route. What would be the most conventional way to do this besides coding the function each time at the top of the main component which each Route loads?Answer:
You can use theuseLocation
and the useEffect
hook:If you have better answer, please add a comment about this, thank you!