S
SolidJS2y ago
Tom

solid-router nested routes - access child params from parent component

It seems like a parent component can't access the full set of params - it can't see params for child routes. Is that right? I get the logic but I have a classic master/detail view, list on the left, with a selected item showing up on the right. In the list I need to be able to detect which item is active, which depends on the nested route param which is not available. My routes:
<Route path='/:bookID' component={BookView}>
<Route path='/' />
<Route path='/blocks/:blockID' component={BlockEditor}/>
</Route>
<Route path='/:bookID' component={BookView}>
<Route path='/' />
<Route path='/blocks/:blockID' component={BlockEditor}/>
</Route>
It seems params.blockID is not available from BookView. I've tried
<Route path='/:bookID'>
<Route path='/' component={BookView} />
<Route path='/blocks/:blockID' component={BookView}/>
</Route>
<Route path='/:bookID'>
<Route path='/' component={BookView} />
<Route path='/blocks/:blockID' component={BookView}/>
</Route>
and replacing <Outlet> with a conditional call of <BlockEditor/>, but then I get a re-init of BookView, which I really want to avoid.
0 Replies
No replies yetBe the first to reply to this messageJoin