简体   繁体   中英

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:

在此处输入图片说明

How can I resolve this issue?

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 @XYZ 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM