I am currently working on a CMS based project.
For which i am using the universal react redux boilerplate by erikras
I really need suggestions on handling dynamic routing
Lets take a simple scenario form the boilerplate...
In routes.js
<Route path="about" component={About}/>
<Route path="login" component={Login}/>
<Route path="survey" component={Survey}/>
<Route path="widgets" component={Widgets}/>
data.js
export const data = [
{id: 1, property: 'Dashboard', link: '/'},
{id: 2, property: 'Login', link: '/login'},
{id: 3, property: 'About Us', link: '/About'},
];
now, let say on the basis of user role, the properties in json data will change
let say new property: is
{id: 4, property: 'test page', link: '/test'}
When react will render the components, how it would know the route link .. as it is not defined in the routes.js
I am not getting the right way to implement it
We need a sidebar made of specific menu content as per the user role .
Let say we are building a reservation system , there can be different user roles like admin, maintenance mode, assistant role
.
So different role will have different properties, accordingly we need to generate the menu on the basis it, as the properties will definitely differ as per user role.
Thanks!!
See Question&Answers more detail:
os