npm i react-router-domimport {
BrowserRouter,
Routes,
Route,
useNavigate,
useParams,
Link,
} from "react-router-dom";



we can also use hooks for const authContext = useContext(AuthContext); and then pass it down from AuthContext.js


How does
this work ?****


authContext :
We are able to access the todos page by directly visiting the link http://localhost:3000/todos even when we are logged out, we have to fix this.
/todos route only when they are logged in. <Route path="/welcome/:username" element={<WelcomeComponent />} />
<Route path="/todos" element={<ListTodosComponent />} />
<Route path="/logout" element={<LogoutComponent />} />
npm i axios


catch, finally and then..then() will get called when the process is successful..catch() is used to catch any errors..finally() will be called irrespective of whether a successful call was made or not. This is basically where we do the cleanup.
Now, we get the following error : (Video 3 and Video 4)



Replacing username :
