Closed devYuraKim closed 2 months ago
BrowserRouter
is required for useNavigate
Solution was quite straightforward: move the AuthProvider
inside the BrowserRouter
From this:
function App() {
return (
<>
<AuthProvider>
<CitiesProvider>
<BrowserRouter>
//... the rest of the code
To this:
function App() {
return (
<>
<BrowserRouter>
<AuthProvider>
<CitiesProvider>
//... the rest of the code
I decided to manage
navigation
within theAuthContext
, rather than handling it inside theUser
component after logout. This would centralize the navigation logic, making it easier to reuse the same path consistently throughout the app.User
componentAuthContext
componentThen got this error