MENU
Installing React Relay
(The different files in this chapter are shared across subsections (45.1 to 45.4), eg. 'schema.graphql', 'fetchGraphQL.js', 'RelayEnvironemnt.js'.)
To install React-Relay:
npm install --save relay-runtime react-relaynpm install --save-dev relay-compiler graphql babel-plugin-relay |
Then edit the file package.json:
{ ... "scripts": { ... "start": "npm run relay && react-scripts start", "build": "npm run relay && react-scripts build", "relay": "relay-compiler --schema schema.graphql --src ./src/ --watchman false $@" ... }, ...} |
Enter 'npm start' to compile the GraphQL schema (schema.graphql above)and all the graphql`...` statements, andthen start the development server.