Reputation: 183
I am trying to create an new react app. I have 3 components: app (with login functionality) , admin and client.
Thank you !
Upvotes: 1
Views: 530
Reputation: 58
You can use react router and in particular route.push('/admin')
You need to define the '/admin' route and voilà.
To bypass the login, you may want to make a 'test-admin' route and a private 'admin' route. Here is how to make a private route if you happen to need it:
https://dev.to/karanpratapsingh/private-public-and-restricted-routes-in-react-42ff
Upvotes: 1
Reputation: 1651
You can use react-router, that allow to define some route based on URL. When you have a login feature, then you would probably wants to have some protected route, that are only accessible when you are logged in. Then I recommend you to read this article
Upvotes: 1