Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
react-router-config does not match on later paths even if there is an exact path match later #5429
Steps to reproduce
Create a react-router-config that has the following:
Try to go to '/' and you are unable to. Why? Because the route matches the first route and "consumes" the request before it realizes that there is a '/' exact match
I expect it to go to the Login page.
It goes to no route because it traverses the routes tree and when it hits someAuthorizedLayout it finds no nested routes that match.
Is this a bug? or is this by design?
If you are saying this is a bug, that means
Please advise. I can see if I can help contribute to fixing this bug but need more info. Thanks
You can workaround this... set flag (variable) as UnauthorizedLayout/someAuthorizedLayout into routes config. Then use matchRoutes, to find matched route, check flag, then do redirect with some status if fail, or just render if it success )...
here is example: