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

242
Views
Show/Hide menus based on User /* Flexible menu by menu */

I have React App with sidebar menus, but I want to hide few of them based on User Role, but don't want common roles like 'ADMIN' , 'MODERATOR', etc. I want to make it flexible, so I can show/hide specific menus on different users
{like in the example below},
menus information will come from the database.

Menus: Employees, Orders, Trucks, Trailers, Bank Accounts, Contacts.



Administrator 1: Orders, Trucks, Trailers
Administrator 2: Employees, Bank Accounts, Contacts
Administrator Supervisor : Employees, Orders, Trucks, Trailers, Bank Accounts, Contacts

Can someone give me advice how should I proceed?

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

0

You can use private routes, with private routes you can put constraints on who can access those routes and when?, you can have simple checks in your html to show or hide those menus so that menus and routes are accessible based on your logic.

here is a very good documentation for you to checkout.

https://dev.to/nilanth/how-to-create-public-and-private-routes-using-react-router-72m

about 4 years ago · Juan Pablo Isaza Report

0

I think your question is already answered. you have to implement role based authorization. you can find your solution here. How to implement multi role based authorization in React

https://jasonwatmore.com/post/2019/02/01/react-role-based-authorization-tutorial-with-example

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!