Search code examples
react-nativerelayjsrelayreact-native-ios

React Native Relay Issue


I'm following along with this tutorial: enter link description here, but I'm getting an issue when I enter these lines of codes:

import Relay, { 
  Route,
  RootContainer,
  DefaultNetworkLayer
} from 'react-relay'

Relay.injectNetworkLayer(new DefaultNetworkLayer('http://localhost:3000/graphql'))

Specifically, the last line is giving me this error:

enter image description here

How can I resolve this issue?


Solution

  • npm install react-relay --save
    

    will not install the same thing as the tutorial author installed if there was an update to this package in the time in between. By default this commands installs the latest.

    Once you figured out what version to use , add that requirement with the @X.Y.Z notation.

    It could also be because, there is a different babel/webpack/rollup set up that messes up the import.

    "react-relay": "0.9.2" is used for the demo here https://github.com/relayjs/relay-examples/blob/master/TodoMVC/package.json