index.tsx
| 1 | /* @refresh reload */ |
| 2 | import { render } from "solid-js/web"; |
| 3 | import "./style.css"; |
| 4 | |
| 5 | import App from "./App"; |
| 6 | import { loadDataFromDB } from "./offline"; |
| 7 | |
| 8 | const root = document.getElementById("root"); |
| 9 | if (!(root instanceof HTMLElement)) { |
| 10 | throw new Error( |
| 11 | "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?", |
| 12 | ); |
| 13 | } |
| 14 | loadDataFromDB() |
| 15 | .then(() => { |
| 16 | root.innerHTML = ""; |
| 17 | render(() => <App />, root); |
| 18 | }) |
| 19 | .catch((e) => { |
| 20 | root.innerHTML = e.toString(); |
| 21 | }); |
| 22 |