@solidjs/router not working

Please can anyone help me out, i have been stuck for days... as i have this issues
No description
15 Replies
foolswisdom
foolswisdom2w ago
It appears to you have your editor set to warn you when misspelled / unknown words are words. solidjs may not appear in the dictionary, but that makes it no less a valid package namespace, and @solidjs/router is the correct package name. This does not stop your package manager from installing it, or is simply the vscode extension warning that it doesn't know this word
Believe037
Believe037OP2w ago
thank you so much. but i seem to have a problem using the package in my code..
foolswisdom
foolswisdom2w ago
You should perhaps open a ticket explaining the issues you are facing I will note, that solid-app-router is superseeded by @solidjs/router, there's no reason to have both in the same project
Believe037
Believe037OP2w ago
I have my index.tsx
No description
Believe037
Believe037OP2w ago
my App.tsx
No description
Believe037
Believe037OP2w ago
Plus nothing displays
Believe037
Believe037OP2w ago
i can't seem to see what is wrong... because in my console i get this error:
No description
Believe037
Believe037OP2w ago
but where can i can open a ticket. i'm new here
foolswisdom
foolswisdom2w ago
What are the contents of Home.tsx?
Believe037
Believe037OP2w ago
import { render } from 'solid-js/web'; import { Router } from '@solidjs/router'; import App from './App'; import 'bootstrap/dist/css/bootstrap.min.css'; const root = document.getElementById('root'); if (import.meta.env.DEV && !(root instanceof HTMLElement)) { throw new Error( 'Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?', ); } render(() => <Router><App /></Router>, root!);
foolswisdom
foolswisdom2w ago
I meant to create a new thread here in #support. It's fine Please enclose code blocks in triple back ticks for readability This the App file. I'm asking about the Home file
Believe037
Believe037OP2w ago
import { Component } from 'solid-js'; const Home: Component = () => { return ( <div> <h2>Home</h2> </div> ) } export default Home;
foolswisdom
foolswisdom2w ago
I think the issue is that the router requires Route components to be direct children Try moving Router to inside the App component, wrapping the Route directly
Believe037
Believe037OP2w ago
Wow wow, you just saved me from a struggle of 3 days... its working like magic Thank you @foolswisdom you are wise
foolswisdom
foolswisdom2w ago
👍 Great

Did you find this page helpful?