SolidJS Router problem

I am really fed up with setting up the navbar for my test app. Can someone help me to setup Router for my two links say (Home, Link1) in navigation bar. How to set up {Router} and {Route} tags? like I have main <App.jsx> file, then <Nav.jsx> in Component folder, <Home.jsx>, <Link1.jsx> in Pages folder. what should I declare in <index.jsx> and what should with <App.jsx> files. The related tutorial is very confusing, there is no mention about, in which file we should set up the <Router> and <Route> tags. thanks in advance.
2 Replies
Brendonovich
Brendonovich12mo ago
It sounds like you aren't using SolidStart's filesystem routing, so the actual files that you put thing in doesn't matter at all. All that matters is that you have a <Router> with a bunch of <Route> instances below it. Whether you pass the <Router> directly to render() or put it in a separate component is up to you. Your root-level component with your navbar would go into the router's root prop, and then your different pages would each be separate <Route> instances.
Rajesh Joshi
Rajesh JoshiOP12mo ago
It worked for me, thanks a lot!
Want results from more Discord servers?
Add your server