Skip to content

Instantly share code, notes, and snippets.

@osdiab
Created December 1, 2016 23:10
Show Gist options
  • Save osdiab/db83840bad1b51be0d09f125c8edda71 to your computer and use it in GitHub Desktop.
Save osdiab/db83840bad1b51be0d09f125c8edda71 to your computer and use it in GitHub Desktop.
// 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