aboutsummaryrefslogtreecommitdiff
path: root/server/frontend/src/index.tsx
blob: 6ab7d4e25d1f158ab74433b1e72f9b2450b1c26b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* @refresh reload */
import { render } from "solid-js/web";

import "./index.css";
import type { RouteDefinition } from "@solidjs/router";
import { Router } from "@solidjs/router";
import { lazy } from "solid-js";

const root = document.getElementById("root");

if (!(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?"
  );
}
const routes: Array<RouteDefinition> = [
  { path: "/", component: lazy(() => import("./App.tsx")) },
  { path: "/test/", component: lazy(() => import("./Test.tsx")) },
];

render(() => <Router>{routes}</Router>, root!);