DEV Community

Discussion on: Protected Routes with React Function Components

Collapse
 
anthonyhumphreys profile image
Anthony Humphreys

Have a read over the answer here: stackoverflow.com/questions/279283...

Client side routing is hard! Basically what you're seeing is the server try to find something at /route, when your SPA loads from /index.html - /route doesn't 'really' exist - until your index.html is read and your JS kicks in. It really blows your mind until you get it. Using react router you can evade this issue by using hashrouting