S
SolidJS11mo ago
Abrinzer

Make sure your app is wrapped in a <Router />

I have a mini app which contains its own route path something like below . This root component is exported out and is being used in main app as a package dependency. Below is the usage mini-app code
<Route path="/path1" component={MainLayout}>
<Route path="/" element={<Navigate href='/home'/>}/>
<Route path="/home" component={() => <div>Hi</div>} />
</Route>
<Route path="/path1" component={MainLayout}>
<Route path="/" element={<Navigate href='/home'/>}/>
<Route path="/home" component={() => <div>Hi</div>} />
</Route>
In the main app usage looks like below
<Router>
<Routes>
<Route path="/" component={MainLayout}>
<Route path="/account" component={Account} />
<Route path="/bills" component={Bills} />
<MiniApp />
</Route>
</Routes>
</Router>
<Router>
<Routes>
<Route path="/" component={MainLayout}>
<Route path="/account" component={Account} />
<Route path="/bills" component={Bills} />
<MiniApp />
</Route>
</Routes>
</Router>
14 Replies
Abrinzer
AbrinzerOP11mo ago
I am getting above error saying Make sure your app is wrapped in a <Router /> though its already wrapped can someone pls help @Alex Lohr
Alex Lohr
Alex Lohr11mo ago
Which version of the vite plugin are you using?
KiloByte
KiloByte11mo ago
Most probably, it's because you're missing a root element https://discord.com/channels/722131463138705510/1193253739868475423
Abrinzer
AbrinzerOP11mo ago
@Alex Lohr 4.0.3
Alex Lohr
Alex Lohr11mo ago
Do you have a root element in your router tag?
Abrinzer
AbrinzerOP11mo ago
No @Alex Lohr , is this required ? and why it is required .. i am not understanding the issue should it be a simple one parent router and then routes
Alex Lohr
Alex Lohr11mo ago
It actually shouldn't be required. I misunderstood the discussion.
Abrinzer
AbrinzerOP11mo ago
I am using solid router 0.9 that doesn't take root Pls help how can i achieve i am working on a mini app and I want all the route to be sitting in the mini app
Alex Lohr
Alex Lohr11mo ago
It would probably be best to update the router to the current version.
Abrinzer
AbrinzerOP11mo ago
what i am doing is it not a good practice or what ? I used to do it well in react native and navigators like this very well I doubt it will work even if I update the solid router version I will then have to keep all my routes in the main app and only export components from mini app package which I don't want.
Alex Lohr
Alex Lohr11mo ago
No, I just meant that there might be errors in an older version of the router that would be fixed by the current version.
Abrinzer
AbrinzerOP11mo ago
Okayy Thank you !!
Alex Lohr
Alex Lohr11mo ago
Did it help?
Abrinzer
AbrinzerOP11mo ago
@Alex Lohr since our codebase is extremely huge. migration is a big effort. I will do this in sample project and keep u posted.
Want results from more Discord servers?
Add your server