Skip to content

Instantly share code, notes, and snippets.

@johnferrie
Created February 2, 2016 00:06
Show Gist options
  • Save johnferrie/9e43f87df607d115549f to your computer and use it in GitHub Desktop.
Save johnferrie/9e43f87df607d115549f to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
import {Router, Route} from 'react-router';
import { createHistory } from 'history';
import config from './config';
import ga from 'react-ga';
import Landing from './pages/Landing';
ga.initialize(config.google.analyticsId);
let logPageView = () => {
ga.pageview(this.state.location.pathname);
};
let routes = (
<Router history={createHistory()} onUpdate={logPageView}>
<Route path="/" component={Landing} />
</Router>
)
ReactDOM.render(routes, document.querySelector('#app'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment