🟢 Protected Route in React | #34 mern stack project Expenses Tracker project | react redux toolkit

preview_player
Показать описание
@i-Novotek 
In this video, we will implement how to protect a component from a user

In this video, we will demo the expenses tracker app

react redux toolkit mern stack project reaction
Рекомендации по теме
Комментарии
Автор

when did you do the logout action?
I do not remember you implementing that till now in this project but you have suddenly implemented that action and dispatched it somehow without teaching us and proceeding further in the project.

ankushmilan
Автор

For anyone watching this, and using react-router-dom v6, here is now to implement authenticated Routes:

in "ProtectedRoute.js"

```
const ProtectedRoute= ({children}) => {
const { userAuth } = useSelector(state => state?.users)
return userAuth ? children : <Navigate replace to="/login" />
}
```

in "App.js"

```
<Route path="/profile" />
```

EllisEnobun
Автор

How many videos are yet to be uploaded ?

abhaysharma