Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Accessing react components directly from URL

I am trying to create an new react app. I have 3 components: app (with login functionality) , admin and client.

  • How can I render (redirect to) admin / client based on a value (user role) , after successfully login?
  • Is this any way to access the admin / client components directly from the URL? More specific, localhost:3000 takes me to App.js (witch makes sense, because it is defined like this in index.js). If I want to see directly the admin component (hijacking the login), can I use for example localhost:3000/admin ? how can I do that?

Thank you !

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

  • 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

about 4 years ago · Juan Pablo Isaza Report

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!