-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.jsx
More file actions
68 lines (62 loc) · 1.35 KB
/
router.jsx
File metadata and controls
68 lines (62 loc) · 1.35 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import {BrowserRouter, Route, Routes, Link, useLocation, useRoutes} from './components/router/react-router-dom';
import Home from './components/home';
import List from './components/list';
import Login from './components/login';
import Detail from './components/list/detail';
import Singer from './components/list/singer';
import Music from './components/list/music';
import Comment from './components/list/comment';
import Create from './components/list/create';
import './App.css';
const Config = [
{
element: <Home/>,
path: '/home'
},
{
element: <Login/>,
path: '/login'
},
{
element: <List/>,
path: '/list',
children: [
{
element: <Detail/>,
path: '/list/detail',
children:[
{
element: <Singer/>,
path: '/list/detail/:singerId'
},
{
element: <Music/>,
path: '/list/detail/music'
},
{
element: <Comment/>,
path: '/list/detail/comment'
}
]
},
{
element: <Create/>,
path: '/list/create'
}
]
}
]
const Index = () => {
const element = useRoutes(Config);
return <div>{element}</div>
}
function App() {
return (
<div>
<BrowserRouter>
<Index/>
</BrowserRouter>
</div>
);
}
export default App;