Created
December 1, 2016 23:10
-
-
Save osdiab/db83840bad1b51be0d09f125c8edda71 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
// pages/WelcomePage.jsx | |
export function WelcomePage(props) { | |
return <h1>props.message</h1>; | |
} | |
// pages/AboutPage.jsx | |
export function AboutPage(props) { | |
return (<ul> | |
<li>props.teammate[0].name</li> | |
<li>props.teammate[1].name</li> | |
</ul>); | |
} | |
// app.js | |
import {WelcomePage, AboutPage} from “./pages”; | |
let Component = null; | |
switch(window.location) { | |
Case “/”: Component = WelcomePage; | |
Case “/about”: Component = AboutPage; | |
} | |
ReactDOM.render( | |
<Component />, | |
document.getElementById(“#content”) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment