Answer the question
In order to leave comments, you need to log in
How to generate Routes in React?
When going to the main page, you need to show the component:
If Login is not authorized
If he is also authorized, then Admin / Dashboard,
If he is also authorized, then Manager / Dashboard,
How can I implement such a scheme?
<Router history={history}>
<Switch>
<Route path="/" permissions={["admin"]} auth component={DashboardAdmin}/>,
<Route path="/" permissions={["manager"]} auth component={DashboardManager}/>,
<Route path="/" noAuth component={LogIn}/>,
</Switch>
</Router>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question