Anchor doesn't load the page
The anchor tag doesn't seem to want to load the page for me.
I have a core router in the index.jsx file
This is how my root router looks
and this is the dashboard
I have a navbar that has links to /dashboard/test1 and 2 and 3 for the fallback
the anchor tags work as it it changes the url but the content doesn't seem to update
also another question: is this a good way to use routers as i used express routers with ejs before this for years and i could just do
12 Replies
couple of things wrong here
1. you've got routers within routers which is most likely not what you want
2. you're putting a router and routes in the
Dashboard
component when you more likely just want it to be a layout component with nested routes
scrap the top level router and just use RootRouter
, and read up on how to do nested routes and layout components: https://github.com/solidjs/solid-router?tab=readme-ov-file#nested-routesgot it
but do i need to define all my routes in the same page?
I mean there's not really any 'page' that you define routes in - the only requirement is that both
<Route>
and <Router>
only contain <Route>
as childreni meant the same .jsx file
but doesn't that imply that i cannot use sub routers
this works as expected
but i was looking for something like
since they're just jsx you can split them into separate components
and the different components can go in different files
ah
they just need to be assembled into one big route tree
got it
thanks
use
DashboardRouter
as a child of the dashboard route and remove the <Router>
you most likely aren't looking for nested routersyeah i figured it out
it just clicked when you said this
![No description](https://cdn.answeroverflow.com/1211955155055153183/image.png)
thanks 🥰