Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs]: Add docs for private/protected route implementation #10206

Closed
differencialx opened this issue Mar 15, 2023 · 5 comments
Closed

[Docs]: Add docs for private/protected route implementation #10206

differencialx opened this issue Mar 15, 2023 · 5 comments
Labels

Comments

@differencialx
Copy link

Describe what's incorrect/missing in the documentation

I would like to see docs about private routes implementation, it's a common use case for applications. People writes articles about how to implement private routes(even for specific versions of react router), but don't you think that it should be documented as well and taken into account during next versions development?
https://dev.to/iamandrewluca/private-route-in-react-router-v6-lg5
https://jasonwatmore.com/post/2022/06/24/react-router-6-private-route-component-to-restrict-access-to-protected-pages

@differencialx differencialx changed the title [Docs]: Add docs for private route implementation [Docs]: Add docs for private/protected route implementation Mar 15, 2023
@timdorr
Copy link
Member

timdorr commented Mar 15, 2023

We have an example for this: https://github.com/remix-run/react-router/tree/dev/examples/auth

@timdorr timdorr closed this as completed Mar 15, 2023
@differencialx
Copy link
Author

@timdorr thank you, sorry for bothering you.

@cristianbriscaru
Copy link

Hi @timdorr , can we have an example for protected routes using the new data router createBrowserRouter ?
I was looking on how to do this using react hook/context to check the user auth status as most react auth libs provide hooks for checking the auth status but I am not sure if we can use hooks or context in createBrowserRouter

an official example for protected routes using hooks/context will really help here

@Karbust
Copy link

Karbust commented Jun 13, 2023

Hi @timdorr , can we have an example for protected routes using the new data router createBrowserRouter ? I was looking on how to do this using react hook/context to check the user auth status as most react auth libs provide hooks for checking the auth status but I am not sure if we can use hooks or context in createBrowserRouter

an official example for protected routes using hooks/context will really help here

Any news about this?

@aress31
Copy link

aress31 commented Jul 7, 2023

I would need an example using createBrowserRouter along with the JSON object definition of the routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants