Solid routing
so i have been trying out solid and i keep having some issues with the router, one of which is the routes tag which i believe is in the older versions but i'm using the newer one and dont really wanna downgrade...
so this is my code:
index.jsx:
please help i keep getting this error:
utils.js?v=22cc6010:29 Uncaught Error: <A> and 'use' router primitives can be only used inside a Route.
7 Replies
What is in your Navbar ?
That's the error. Your Navbar uses A
A should only be used in a Route element
yes i get that but i want to have client side rendering
is there any fix for it
my english is not the best could you please tell me where i should put my navbar?
When you want a component to appear on every page, you should think of Layout and/or nested routing.
You can use a Layout root like this example here to put your Navbar onto every page https://docs.solidjs.com/solid-router/concepts/layouts (i.e. put your Navbar in a Layout component)
Perhaps this will give you a sense of how to organize things:
https://stackblitz.com/edit/stackblitz-starters-zmfxxa?file=src%2Fapp.tsx
peerreynders
StackBlitz
solid-router Basic (forked) - StackBlitz
A Solid TypeScript project based on @solidjs/meta, @solidjs/router, solid-js, typescript, vite and vite-plugin-solid
Thanks, both of these sources helped
i really appreciate the help