-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.tsx
50 lines (43 loc) · 913 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import React from 'react';
import { createRoot } from 'react-dom/client';
import { About } from './about';
import { Home } from './home';
import {
Router,
RouteComponent,
createBrowserHistory,
} from 'react-resource-router';
const myHistory = createBrowserHistory();
const appRoutes = [
{
name: 'home',
path: '/',
exact: true,
component: Home,
navigation: null,
},
{
name: 'about',
path: '/about',
exact: true,
component: About,
navigation: null,
},
];
const App = () => {
return (
<Router
basePath="/basic-routing"
history={myHistory}
routes={appRoutes}
plugins={[]}
>
<RouteComponent />
</Router>
);
};
const container = document.getElementById('root');
if (!container)
throw new Error('No root element found to render basic routing example');
const root = createRoot(container);
root.render(<App />);