Last active
January 31, 2017 00:28
-
-
Save DreySkee/bb1b843008db93f7966aef9fad8c9611 to your computer and use it in GitHub Desktop.
10 - Wordpress API + ReactJS
This file contains 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 {render} from 'react-dom'; | |
import App from './components/App.js'; | |
import Home from './components/Home.js'; | |
import DataActions from './actions/DataActions.js'; | |
import { | |
browserHistory, | |
IndexRoute, | |
Redirect, | |
Route, | |
Router | |
} from 'react-router'; | |
class AppInitializer { | |
run() { | |
DataActions.getPages((response)=>{ | |
render( | |
<Router history={browserHistory}> | |
<Route path="/" component={ App } > | |
<IndexRoute component={ Home } /> | |
</Route> | |
<Redirect from="*" to="/" /> | |
</Router> | |
, document.getElementById('app') | |
); | |
}); | |
} | |
} | |
new AppInitializer().run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment