Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created July 3, 2016 22:20
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 chuck0523/279c27f594faa184334124f1a7dfeaf2 to your computer and use it in GitHub Desktop.
Save chuck0523/279c27f594faa184334124f1a7dfeaf2 to your computer and use it in GitHub Desktop.
import 'babel-polyfill'
import React from 'react'
import ReactDOM from 'react-dom'
import Relay from 'react-relay'
import applyRouterMiddleware from 'react-router/lib/applyRouterMiddleware'
import Router from 'react-router/lib/Router'
import useRouterHistory from 'react-router/lib/useRouterHistory'
import useRelay from 'react-router-relay'
import RelayLocalSchema from 'relay-local-schema'
import createHashHistory from 'history/lib/createHashHistory'
import routes from './routes'
import { Schema as schema } from '../data/schema'
Relay.injectNetworkLayer(
new RelayLocalSchema.NetworkLayer({ schema })
)
const history = useRouterHistory(createHashHistory)({query: false})
ReactDOM.render(
<Router
history={history}
routes={routes}
render={applyRouterMiddleware(useRelay)}
environment={Relay.Store}
/>,
document.querySelector('#app')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment