Create React App

Create React App

  • Getting started
  • Help
  • GitHub

›Building your App

Welcome

  • About The Docs

Getting Started

  • Getting Started
  • Folder Structure
  • Available Scripts
  • Browsers & Features
  • Updating To New Releases

Development

  • Editor Setup
  • Developing Components In Isolation
  • Analyzing Bundle Size
  • HTTPS In Development

Styles and Assets

  • Adding Stylesheets
  • Adding CSS Modules
  • Adding Sass Stylesheets
  • Post-Processing CSS
  • Adding Images, Fonts, And Files
  • Using The public Folder
  • Code Splitting

Building your App

  • Installing A Dependency
  • Importing A Component
  • Using Global Variables
  • Adding Bootstrap
  • Adding Flow
  • Adding Relay
  • Adding A Router
  • Environment Variables
  • Making A Progressive Web App

Testing

  • Running Tests
  • Debugging Tests

Back-End Integration

  • Proxying In Development
  • Fetching Data
  • Integrating With An API
  • Title & Meta Tags

Deployment

  • Deployment

Advanced Usage

  • Can I Use Decorators?
  • Pre-Rendering Static HTML
  • Advanced Configuration
  • Alternatives To Ejecting

Support

  • Troubleshooting

Adding Relay

Relay is a framework for building data-driven React applications powered by GraphQL. The current release candidate of Relay works with Create React App projects out of the box using Babel Macros. Simply set up your project as laid out in the Relay documentation, then make sure you have a version of the babel plugin providing the macro.

To add it, run:

npm install --save --dev babel-plugin-relay@dev

Alternatively you may use yarn:

yarn upgrade babel-plugin-relay@dev

Then, wherever you use the graphql template tag, import the macro:

import graphql from 'babel-plugin-relay/macro';
// instead of:
//   import { graphql } from "babel-plugin-relay"

graphql`
  query UserQuery {
    viewer {
      id
    }
  }
`;

To learn more about Relay, check out its documentation.

← PreviousNext →
Create React App
Docs
Getting StartedDocumentation
Community
Stack OverflowSpectrumTwitter
More
GitHubStar
Facebook Open Source
Copyright © 2018 Facebook Inc.