You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
React
48 lines
1.1 KiB
React
2 years ago
|
import React from "react";
|
||
|
import { configure } from "mobx";
|
||
|
import ReactDOM from "react-dom/client";
|
||
|
import {
|
||
|
createBrowserRouter,
|
||
|
RouterProvider,
|
||
|
} from "react-router-dom";
|
||
|
import RootStore from "./stores/Root";
|
||
|
import { StoreContext } from './stores/StoreContext.js';
|
||
|
import "./global.css";
|
||
|
import App from "./views/App";
|
||
|
import Index from "./views/index";
|
||
|
import ErrorPage from "./error-page";
|
||
|
import Plan from "./views/Plan";
|
||
|
|
||
|
configure({
|
||
|
useProxies: "ifavailable",
|
||
|
enforceActions: "always",
|
||
|
computedRequiresReaction: true,
|
||
|
reactionRequiresObservable: true,
|
||
|
observableRequiresReaction: true,
|
||
|
disableErrorBoundaries: true
|
||
|
});
|
||
|
|
||
|
const router = createBrowserRouter([
|
||
|
{
|
||
|
path: "/",
|
||
|
element: <App />,
|
||
|
errorElement: <ErrorPage />,
|
||
|
children: [
|
||
|
{ index: true, element: <Index /> },
|
||
|
{
|
||
|
path: "plan/:planId",
|
||
|
element: <Plan />,
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]);
|
||
|
|
||
|
const rootStore = new RootStore();
|
||
|
|
||
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
||
|
<React.StrictMode>
|
||
|
<StoreContext.Provider value={rootStore}>
|
||
|
<RouterProvider router={router} />
|
||
|
</StoreContext.Provider>
|
||
|
</React.StrictMode>
|
||
|
);
|