Created
June 25, 2017 15:47
-
-
Save gregberge/ff82a48bfadba033962c69cb2ac6378a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import ReactDOM from 'react-dom' | |
import { BrowserRouter, Route } from 'react-router-dom' | |
import loadable, { loadComponents } from 'loadable-components' | |
const Home = loadable(() => import('./Home')) | |
const About = loadable(() => import('./About')) | |
const Topics = loadable(() => import('./Topics')) | |
const App = () => | |
<BrowserRouter> | |
<div> | |
<ul> | |
<li><Link to="/">Home</Link></li> | |
<li><Link to="/about">About</Link></li> | |
<li><Link to="/topics">Topics</Link></li> | |
</ul> | |
<hr /> | |
<Route exact path="/" component={Home} /> | |
<Route path="/about" component={About} /> | |
<Route path="/topics" component={Topics} /> | |
</div> | |
</BrowserRouter> | |
loadComponents().then(() => { | |
ReactDOM.render(<App />, document.getElementById('main')) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment