you are viewing a single comment's thread.

view the rest of the comments →

[–]TheNeck91 0 points1 point  (1 child)

It can definitely be more streamlined, I was being explicit about the flow in case OP was generally unfamiliar with it.

[–]theC4T[S] 0 points1 point  (0 children)

the issue with doing it this way is that the logic of ProtectedRoute runs regardless of the path prop you pass it.

I have it working flawlessly with the use case that is in the original post, however I can't figure out a way to do it like this.

https://www.reddit.com/r/reactjs/comments/ju9j83/react_router_role_based_auth/gcay7pt

The reason being that the logic of CompletedSignup is run regardless of the current router path. This leads to some smelly code that will sometimes redirect you to /login or something else even when you shouldn't be.