Skip to content

Instantly share code, notes, and snippets.

@DreySkee
Last active June 16, 2017 17:37
Show Gist options
  • Save DreySkee/6a325a8f0c107264efb34919dee41a2e to your computer and use it in GitHub Desktop.
Save DreySkee/6a325a8f0c107264efb34919dee41a2e to your computer and use it in GitHub Desktop.
9 - Wordpress API + ReactJS (Updated)
import {render} from 'react-dom';
import DataActions from 'flux/actions/DataActions.js';
import Home from 'components/Home.js';
import {
BrowserRouter as Router,
Route,
Redirect,
Switch
} from 'react-router-dom';
class AppInitializer {
run() {
DataActions.getPages((response)=>{
render(
<Router>
<div>
<Switch>
<Route path="/" component={ Home } exact />
<Route render={() => { return <Redirect to="/" /> }} />
</Switch>
</div>
</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