Create a SecuredRoute component for route-level security #10115
brettvniekerk
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've run into several occasions where I'm creating logic that behaves in this way:
some example code:
I think
react-router
might benefit from aSecuredRoute
component that implementsaccessible: boolean
andfallback: string
props that expands to the logic above.Example implementation:
In this implementation, if
isUserAuthed
isfalse
, then the route/account
will navigate back to/
, otherwise the route will be accessible.Beta Was this translation helpful? Give feedback.
All reactions