+ 1
how to render the sublist only when one of the routes inside is active?
const pages: Page = { termsPage: [ {name: 'First Page', path: '/one/two/'}, { name: 'Second Page', path: '/three/four/', routes: [ {name: 'subpage1', path: '/sub1/'}, {name: 'subpage2', path: '/sub2/'} ] }, {name: 'Third Page', path: '/five/six/'}, {name: 'Fourth Page', path: '/seven/eight/'}, {name: 'Fives Page', path: '/nine/ten/'} ]; }
5 ответов
+ 1
Ahmad check out how router routes the routes
https://code.sololearn.com/WukMCoMDyUf6/?ref=app
+ 1
For nested routing, you could use useRouteMatch with useParams.
+ 1
Ahmad Study the session of Nesed Routing, would help you to build the routes.
https://reacttraining.com/react-router/web/guides/quick-start
+ 1
Thanks @Calvin that was quite helpful.
0
@Vivek as you see in this function we have the siblings array routes inside of the secondPage, i want to see the sublist(routes) as i click on the second page and the it redirects to first sublist it becomes active.