Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 2.17 KB

File metadata and controls

63 lines (44 loc) · 2.17 KB

React + GraphQL Sample App

You can view the recording from Boston React Conf 2018 where I presented the talk associated with this repo:

boston react conf talk video

This sample app demonstrates how to integrate React app with a GraphQL API. The app uses the Apollo framework along with its stellar React bindings to interact with the GitHub GraphQL API. In addition, the focus was on the pattern of collocating queries with components, specifically highlighting the use of fragments within sub-components to allow each component to own its data, while allowing the application to compose queries from the fragments and efficiently interact with the GraphQL API.

Typescript

The master branch contains the default JS based implementation of the application. In the typescript branch all components are converted to TypeScript, and via the magic of Apollo CLI, relevant types are generated for each component with data needs.

Setup

Dependencies

This project uses yarn to manage dependencies.

yarn install

GitHub Token

You'll need to to generate a GitHub personal access token with repo and read:org scopes. Once generated, add it to a .env file:

GITHUB_TOKEN=abcdef-secret-token

Note - The app will be connected to live data and your account based on the token you provide. The only action built into the app is to Star & Unstar repositories, but just be super clear, those actions will be reflected on github.com.

Starting the App

The app can be started with:

yarn start