Bootstrapping Relay
At this point, we have the GraphQL backend up and running. Now, we can focus on our React components in the frontend. In particular, we're going to look at Relay in a React Native context, which really only has minor differences. For example, in web apps, it's usually react-router
that bootstraps Relay. In React Native, it's a little different. Let's look at the index file that serves as the entry point for our native app:
import React from 'react'; import { AppRegistry } from 'react-native'; import Relay, { DefaultNetworkLayer, RootContainer, } from 'react-relay'; import viewerQueries from './queries/ViewerQueries'; import TodoApp from './TodoApp'; // Since this is a native app instead of a web // app, we have to tell Relay where to find // the GraphQL backend. Relay.injectNetworkLayer( new DefaultNetworkLayer('http://localhost:8080') ); AppRegistry.registerComponent...