Skip to content

Instantly share code, notes, and snippets.

@johncmckim
Created August 28, 2016 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johncmckim/dce74bc5946fb4a1a85f66e2ad6da4b8 to your computer and use it in GitHub Desktop.
Save johncmckim/dce74bc5946fb4a1a85f66e2ad6da4b8 to your computer and use it in GitHub Desktop.
Garden Aid - React - Entry Point
import { GRAPHQL_URL } from 'constants';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import withScroll from 'scroll-behavior';
import ApolloClient, { createNetworkInterface } from 'apollo-client';
import { ApolloProvider } from 'react-apollo';
import createAppStore from './store';
import getRoutes from './routes';
const networkInterface = createNetworkInterface(GRAPHQL_URL);
const client = new ApolloClient({ networkInterface });
const scrollBrowserHistory = withScroll(browserHistory);
const store = createAppStore(scrollBrowserHistory, client);
const history = syncHistoryWithStore(scrollBrowserHistory, store);
ReactDOM.render(
<ApolloProvider store={store} client={client}>
<Router history={history}>{getRoutes(store)}</Router>
</ApolloProvider>,
document.getElementById('app')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment