SolidJSS
SolidJSโ€ข16mo agoโ€ข
13 replies
Spaghetto

Can't make Router Work

Hello

I've been trying to make react router work. Here's what I have as of now in the index.tsx file
/* @refresh reload */
import './index.css';

import { render } from 'solid-js/web';
import { Route, Router } from '@solidjs/router';




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> 
    <Route path={"/"} component={() =><h1>Hello World</h1> }/>
  </Router> 
  </> 
  , root );


Here's what I'm getting on the browser
image.png
Was this page helpful?