Created
April 1, 2018 22:38
-
-
Save horacioh/c5697d5e4bff5ccd6b5a33aea5b0299e to your computer and use it in GitHub Desktop.
RN Scaffold - index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MyApp/src/app/index.js | |
import React, { Component } from 'react'; | |
import { API_URL } from './config'; | |
import ApolloClient from 'apollo-client'; | |
import { HttpLink } from 'apollo-link-http'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; | |
import Root from './Root'; | |
const graphqlClient = new ApolloClient({ | |
// By default, this client will send queries to the | |
// `/graphql` endpoint on the same host | |
link: new HttpLink({ | |
uri: `${API_URL}/graphql`, | |
}), | |
cache: new InMemoryCache(), | |
}); | |
//TODO: setup all providers, stores... (like graphqlClient) and pass it to Root component | |
export default class MainEntry extends Component { | |
render() { | |
return <Root graphqlClient={graphqlClient} />; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment