Skip to content

Instantly share code, notes, and snippets.

@lamosty

lamosty/index.js

Created Nov 9, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.