S
SolidJS•15mo ago
Ostof

Set Initial Route using @solidjs/router

Hello, I have a simple Router setup with 3 routes/tabs inside my Main component
<Routes>
<Route path={'/1'} component={Tab1}></Route>
<Route path={'/2'} component={Tab2}></Route>
<Route path={'/3'} component={Tab3}></Route>
</Routes>
<Routes>
<Route path={'/1'} component={Tab1}></Route>
<Route path={'/2'} component={Tab2}></Route>
<Route path={'/3'} component={Tab3}></Route>
</Routes>
I want to make sure that every time the page is reloaded users are navigated to /1. Currently I just call navigate('/1') using the useNavigate from the Router package inside the Main component and just wanted to know if there is another/better way to do this.
1 Reply
bigmistqke
bigmistqke•15mo ago
every time the page is reloaded users are navigated to /1
Mm 🤔 so when people click a link to /2 it should lead to tab2 but once they reload that page w URL /2 it should go to tab1?
Want results from more Discord servers?
Add your server