Skip to content

Instantly share code, notes, and snippets.

@osdiab
Created December 1, 2016 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osdiab/df557a7a50feef414eadc8616d6762f7 to your computer and use it in GitHub Desktop.
Save osdiab/df557a7a50feef414eadc8616d6762f7 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