1import React, { Component } from 'react';
2import { render } from 'react-dom';
3import { BrowserRouter, Route, Switch, Link } from 'react-router-dom';
4import { Home } from 'wherever-you-put-it/home.component.jsx';
5import { Something } from 'wherever-you-put-it/something.component.jsx';
6import { SomethingElse } from 'wherever-you-put-it/something-else.component.jsx';
7
8class App extends Component {
9 render() {
10 return (
11 <BrowserRouter>
12 <Switch>
13 <Route path="/">
14 <Home />
15 </Route>
16 <Route path="/something">
17 <Something />
18 </Route>
19 <Route path="/somethingelse">
20 <SomethingElse />
21 </Route>
22 </Switch>
23 <SomeComponentOrElement>
24 <Link to="/">Home</Link>
25 <Link to="/something">Something</Link>
26 <Link to="/somethingelse">Something Else</Link>
27 </SomeComponentOrElement>
28 </BrowserRouter>
29 )
30 }
31}
32
33render(<App />, document.getElementById('app'));
1<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
2<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>