MERN Authentication Tutorial #16 - Protecting React Routes

preview_player
Показать описание
In this MERN auth tutorial we'll protect some of the React routes from users that are not authenticated.

⭐⭐ Get the full course now (without ads) on the Net Ninja Pro site:

⭐⭐ Get access to all free & PREMIUM courses on Net Ninja Pro:

🐱‍💻 Access the course files on GitHub:

🐱‍💻 MERN Stack Tutorial:

🐱‍💻 React Tutorial:

🔥🔥🔥 Other resources:
Рекомендации по теме
Комментарии
Автор

Funny enough, that little margin was bugging me too. lol. Thank you for these Shaun! You're seriously top 3 best teachers

Aaronmoreno
Автор

Gooosh. You're tireless. Even in August you work like a stream.

DarioBasset
Автор

straight forward and into the point I love your style thanks a lot

maxjustmax
Автор

i was practicing while waiting for this 🔥🔥😍😍

towatch
Автор

This was a great tutorial. Can you consider adding a search page lesson. Like I only want to show workouts with 10 reps or workouts with setups etc etc ability to search and filter on any field ?

johnmargotti
Автор

Awesome course again, but I am stumped on this one when it comes to passing the user to the routes. I have updated my react router to v6 with createBrowserRouter. I was wondering how do I go about passing the { user } to that?

camakarzie
Автор

How much time it will take you to complete this project basically asking how much videos are left?

aslamkhan-xdjz
Автор

Hey gang are you going to do the forgot password video?

dixonsouare
Автор

I am doing the element={user ? <Workout /> : <Navigate to="/login" />}, but am being re-directed to the login page even if I know there is a user in state. I am console.logging user Auth context, and it logs as null twice then with the correct current user data twice. So, on initial check, it thinks that there is no user and re-routes to /login. How do I fix this?

thrivingCephalopod
Автор

But why do we check just if there's a user, and not if the user is authenticated? I might be wrong, but the get item from the local storage doesnt just check if something called user exists? What if a person just adds it to the local storage by hand? Isnt there a way to check if the token if correct?

aceanimations
Автор

Why not doing like this: <Route path="/login" elementt={ ?user ? <Login /> : <Home/> } ? 🙄

maskman
Автор

After this step whenever I'm refreshing any other page it is
always taking me back to homepage. How to solve this?

solomormex
Автор

Is this the only way? I mean I have 40 routes. Do I have to validate in each one if there is a user logged in?

FellTheSky
Автор

my searching your discord community for help but didn’t get

programming-dude
Автор

Has any of your work been compromised by the increased number of hackers?

Monster
Автор

I want to hide the navbar in login screen,

can Anyone help me please?

shinoy