Need help in solid-router
my development
The mess
I tried to use
useRoutes
in Config Based Routing style, and i figured out it's no longer support in ^0.10.0
.
So i change my code like this:
In index.tsx
๐
In Layout.tsx
๐
When using the useRoutes
it works, but i can't use it anymore. So is there another way๐ ?3 Replies
You'll want to provide your layout as a root-level layout, check out step 2 of the docs: https://github.com/solidjs/solid-router
GitHub
GitHub - solidjs/solid-router: A universal router for Solid inspire...
A universal router for Solid inspired by Ember and React Router - GitHub - solidjs/solid-router: A universal router for Solid inspired by Ember and React Router
thx. I fix the error with your help, then I find my routes config is wrong. At the end I trun my code into the below and every thing done.
index.tsx
routes.tsx
layout.tsx
I wonder if there is a better way like Outlet
in react, rather than props.children
and (props) => <Comp>{props.children}</Comp>
solid-router 0.9 used
<Outlet>
, but props.children
is a superior solution