Nested layouts with dynamic route
I am using solid start with file based routing. I want to create routes with nested layout. I want to have routes
/plans/[id]
and /plans/[id]/select
. Both of these routes should share same layout, how can I acheive it with dynamic paremeter?4 Replies
I think start first by creating a folder called plan, then nest a folder named [id] and nest the file like select.jsx/tsx.
In order to specify a layout create an index.jsx/tsx or (plan).jsx/tsx page in plan folder. In that file,return a default component which accepts children as props and render {props.children} in that component.
But I want only shared layout only for
/plans/[id]
and /plans/[id]/select
. I already have plans
folder. There I have index.tsx
which is route for all plans. I have also [id].tsx
route there which is for plan details. I want to add now route /plans/[id]/select
which should have shared layout only with /plans/[id]
. Sorry for confusion, should clarify it in the first message
that should do it
this works, but there is problem if I open
/plans/[id]
and /plans/[id]/select
diirectly. If I go to this page with Link
component it works fine