Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
119 lines (105 loc) · 2.33 KB
/
Copy pathindex.js
File metadata and controls
119 lines (105 loc) · 2.33 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, NavLink, Route } from 'react-router-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import 'bootstrap/dist/css/bootstrap.css';
function About(props) {
return (
<div>
<h1>About Component</h1>
<p>This is the About page</p>
</div>
);
}
function Home(props) {
return (
<div>
<h1>Home Component</h1>
<p>This is the Home page</p>
</div>
);
}
function Products(props) {
const { match } = props;
return (
<div>
<h1>Products Component</h1>
<p>This is the Products page</p>
<ul>
<li className="navlink">
<NavLink to={`${match.url}/music`} activeClassName="navlink--selected" exact>
Music
</NavLink>
</li>
<li className="navlink">
<NavLink to={`${match.url}/movies`} activeClassName="navlink--selected">
Movies
</NavLink>
</li>
<li className="navlink">
<NavLink to={`${match.url}/books`} activeClassName="navlink--selected">
Books
</NavLink>
</li>
</ul>
<Route path={`${match.path}/music`} component={Music} />
<Route path={`${match.path}/movies`} component={Movies} />
<Route path={`${match.path}/books`} component={Books} />
</div>
);
}
function Music(props) {
return (
<div>
<h1>Music Component</h1>
<p>This is the Music page</p>
</div>
);
}
function Movies(props) {
return (
<div>
<h1>Movies Component</h1>
<p>This is the Movies page</p>
</div>
);
}
function Books(props) {
return (
<div>
<h1>Books Component</h1>
<p>This is the Books page</p>
</div>
);
}
function greeter() {
}
ReactDOM.render(
<Router>
<div>
<ul>
<li className="navlink">
<NavLink to="/" activeClassName="navlink--selected" exact>
Home
</NavLink>
</li>
<li className="navlink">
<NavLink to="/about" activeClassName="navlink--selected">
About
</NavLink>
</li>
<li className="navlink">
<NavLink to="/solutions" activeClassName="navlink--selected">
Solutions
</NavLink>
</li>
</ul>
<Route path="/" component={Home} exact />
<Route path="/about" component={About} />
<Route path="/solutions" component={Products} />
</div>
</Router>
, document.getElementById('root'));
registerServiceWorker();