Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

246
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda