Skip to content

Instantly share code, notes, and snippets.

@lamosty
Created November 9, 2015 14:15
Show Gist options
  • Save lamosty/73e3b1f840c61901c566 to your computer and use it in GitHub Desktop.
Save lamosty/73e3b1f840c61901c566 to your computer and use it in GitHub Desktop.
Main file for the Lexi WP theme, from the tutorial about React WP theme: https://lamosty.com/2015/11/react-wp-theme-bootstrap-blog-to-react-components-router
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import { Provider } from 'react-redux';
import { Router, Route, IndexRoute } from 'react-router';
import configureStore from './store/configureStore';
import LexiTheme from './containers/LexiTheme';
import ArticlePage from './containers/ArticlePage';
import ArticleListingPage from './containers/ArticleListingPage';
import AboutPageContainer from './containers/AboutPageContainer';
import '../sass/bootstrap.css';
import '../sass/bootstrap-blog.css';
const history = new createBrowserHistory();
const store = configureStore();
let rootElement = document.getElementById('root');
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={LexiTheme}>
<IndexRoute component={ArticleListingPage} />
<Route path="about" component={AboutPageContainer} />
<Route path=":year/:month/:name" component={ArticlePage} />
</Route>
</Router>
</Provider>,
rootElement
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment