Skip to content

Instantly share code, notes, and snippets.

@horacioh
Created April 1, 2018 22:38
Show Gist options
  • Save horacioh/c5697d5e4bff5ccd6b5a33aea5b0299e to your computer and use it in GitHub Desktop.
Save horacioh/c5697d5e4bff5ccd6b5a33aea5b0299e to your computer and use it in GitHub Desktop.
RN Scaffold - index.js
// 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