Created
July 21, 2016 21:29
-
-
Save ooade/9c38527e6c5e70dd73c8938c2e78bd63 to your computer and use it in GitHub Desktop.
Main JS file with react-router
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
// Grab the react and react-dom pkgs --> | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
// Grab Router, Route and browserHistory from react-router -> | |
import { Router, Route, IndexRoute, browserHistory } from 'react-router'; | |
// Grab Navigation component --> | |
import Navigation from '../components/navigation'; | |
// Write an App Component --> | |
const App = () => { | |
return ( | |
<div> | |
<Navigation /> | |
</div> | |
); | |
}; | |
// Start Routes --> | |
const routes = ( | |
<Router history={browserHistory}> | |
<Route path="/" component={App}> | |
{/*...We will have some other routes here...*/} | |
</Route> | |
</Router> | |
); | |
// Render the App Component to the app class | |
// Use Meteor.startup (Makes sure the Meteor app starts up before you try rendering to the DOM) | |
Meteor.startup(() => { | |
ReactDOM.render(routes, document.querySelector('.app')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment