Skip to content

Instantly share code, notes, and snippets.

@DreySkee
Last active January 31, 2017 00:28
Show Gist options
  • Save DreySkee/bb1b843008db93f7966aef9fad8c9611 to your computer and use it in GitHub Desktop.
Save DreySkee/bb1b843008db93f7966aef9fad8c9611 to your computer and use it in GitHub Desktop.
10 - Wordpress API + ReactJS
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