kendo-react/docs/main.tsx

31 строка
773 B
TypeScript
Исходник Обычный вид История

2024-04-23 15:24:52 +03:00
import { StrictMode } from 'react';
import * as ReactDOM from 'react-dom/client';
import React from 'react';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import Index from './_app';
import ErrorPage from './_error';
import routes from './routes';
const init = async () => {
const allRoutes = await routes();
const router = createBrowserRouter([
{
path: "/",
element: <Index routes={allRoutes} />,
errorElement: <ErrorPage />
},
...allRoutes
]);
const root = ReactDOM.createRoot(
document.querySelector('my-app') as HTMLElement
);
root.render(
<StrictMode>
<RouterProvider router={router} />
</StrictMode>
);
};
init();