Javascript – Restrict certain routes from accessing if the user is logged in in React using same PrivateRoute used for block in user is not logged in
We can restrict certain routes if the person is not logged in. However, how can we restrict certain routes for rendering if the user is logged in? Below is my routing configuration: <BrowserRouter> <MenuBar /> <Routes> <Route path='/' element={<PrivateRoute><Dashboard /></PrivateRoute>}…