mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 12:15:37 +08:00
replace require with es6 import in docs
Reviewed By: svcscm Differential Revision: D2936839 fb-gh-sync-id: 7a921709a37de5e9aadf324d5438d51851326348 shipit-source-id: 7a921709a37de5e9aadf324d5438d51851326348
This commit is contained in:
committed by
facebook-github-bot-7
parent
2260d900d4
commit
3ae99d0fea
@@ -96,12 +96,12 @@ You need to run `adb reverse tcp:8081 tcp:8081` to forward requests from the dev
|
||||
|
||||
## Module that uses `WebSocket` (such as Firebase) throws an exception
|
||||
|
||||
React Native implements a polyfill for WebSockets. These polyfills are initialized as part of the react-native module that you include in your application through `require('react-native')`. If you load another module that requires WebSockets, be sure to load/require it after react-native.
|
||||
React Native implements a polyfill for WebSockets. These polyfills are initialized as part of the react-native module that you include in your application through `import React from 'react-native'`. If you load another module that requires WebSockets, be sure to load/require it after react-native.
|
||||
|
||||
So:
|
||||
```
|
||||
var React = require('react-native');
|
||||
var Firebase = require('firebase');
|
||||
import React from 'react-native';
|
||||
import Firebase from 'firebase';
|
||||
```
|
||||
|
||||
Requiring firebase *before* react-native will result in a 'No transports available' redbox.
|
||||
|
||||
Reference in New Issue
Block a user