react-chrome-extension-router
react-chrome-extension-router copied to clipboard
Private Route
Hi, I am trying to build a private route which allows to go to a certain component only if the user is logged-in.
With 'react-router-dom', it is supposed to look like this:
export default function PrivateRoute({ children }) { const { currentUser } = useAuth()
return currentUser ? children : <Navigate to="/login" /> }
And I'm calling this with: <Router> <Route exact path="/" element={<PrivateRoute> <Dashboard /> </PrivateRoute> } /> <Router />
Any idea on how to implement it with this package ? Thank you for your help!