TTime/frontend/src/main.tsx

29 lines
724 B
TypeScript
Raw Normal View History

import React from "react";
import ReactDOM from "react-dom/client";
import SettingsPage from "./Pages/Settings.tsx";
import HomePage from "./Pages/Home.tsx";
import "./index.css";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
// This is where the routes are mounted
const router = createBrowserRouter([
{
path: "/",
element: <HomePage />,
},
{
path: "/settings",
element: <SettingsPage />,
},
]);
// Semi-hacky way to get the root element
const root = document.getElementById("root") ?? document.createElement("div");
// Render the router at the root
ReactDOM.createRoot(root).render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>,
);