-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathNews.js
37 lines (34 loc) · 784 Bytes
/
News.js
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
import { Helmet } from 'react-helmet';
import { Link, Switch, Route, useRouteMatch } from 'react-router-dom';
export default function News() {
let match = useRouteMatch();
return (
<>
<Helmet>
<title>News</title>
</Helmet>
<h1>News page</h1>
<ul>
<li>
<Link to={`${match.url}/components`}>Components</Link>
</li>
<li>
<Link to={`${match.url}/props-v-state`}>
Props v. State
</Link>
</li>
</ul>
<Switch>
<Route path={`${match.path}/:id`}>
<Detail />
</Route>
<Route path={match.path}>
<h3>Please select a topic.</h3>
</Route>
</Switch>
</>
);
}
function Detail() {
return <h2>Detail</h2>
}