UNPKG

845 BJavaScriptView Raw
1import React from 'react';
2import ReactDOM from 'react-dom';
3
4import { AppContainer } from 'react-hot-loader';
5// import walkMD from './walkmd';
6// AppContainer is a necessary wrapper component for HMR
7import {
8 BrowserRouter as Router,
9 Route,
10 Link
11} from 'react-router-dom';
12
13import App from './App';
14
15
16const About = () => {
17 return (
18 <div>about</div>
19 )
20}
21
22const Topics = () => {
23 return (
24 <div>Topics</div>
25 )
26}
27
28const render = (Component) => {
29 ReactDOM.render(
30 <Router>
31 <AppContainer>
32 <Component/>
33 </AppContainer>
34 <Route path="/about" component={About}/>
35 <Route path="/topics" component={Topics}/>
36 </Router>
37 ,
38 document.getElementById('root')
39 );
40};
41
42render(App);
43
44
45// Hot Module Replacement API
46if (module.hot) {
47 module.hot.accept('./App', () => {
48 render(App)
49 });
50}
\No newline at end of file