Solidjs route not working...
I am getting an error which you can see in the image and I can't see the content which I put in there.
I am using Solidjs 1.8.11 with @solidjs/router 0.13.2 and JS
My code -
Index.jsx -
App.jsx -
home.jsx -
home.jsx is in ./src/pages
while App.jsx & index.jsx are in ./src
10 Replies
GitHub
GitHub - solidjs/solid-router: A universal router for Solid inspire...
A universal router for Solid inspired by Ember and React Router - solidjs/solid-router
ohh ok lemme check
So i changed the routes to router but I have a bit problem in index.jsx
I dont know much abt solid so dunno how to do it
index.jsx -
see the last 4 lines
i my original code I had <App />
the documetaion wants to add <Router /> there
what should I do
you can put whatever you want in
index
, as long as your router is somewhere in your app
then the router should have all its routes as childrenumm ok lemme try
I found this code for the routers and route, should I put it in the App.jsx or index.jsx?
it worked
I did something
now I wanna ask something for the last time
in App.jsx -
Do i need the function App
cuz its not like its doing something here
right?
actually
When I delete that code
my website dosent work
now what
I have two same things in the website
-
index.tsx
renders App.tsx
and pulls in the app with an import
- App.tsx
defines the app component and needs to export it
- what you don't need is the render function in App.tsx
Though that's just convention. If you put everything in index.tsx
that should still work as well.
Don't worry about my tsx
vs jsx
. jsx
just means that you are responsible for tracking these kind of things yourself rather than having TypeScript yell at you all the time.hmmm k
I rewrite it and now it works
App.jsx -
thanks both of u
it works perfectly fine
You mean I can work with index.jsx only + components + pages and remove App.jsx?
btw I dont understand this statement from the App.jsx, can someone explain this -
I remember having done that and it worked but it's not the pattern that everyone follows.
well then maybe I will not ig....
root
is the wrapper (layout) that will be used around every Route
component.hmm k
thanks
problem solved
closing post