Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are fetch() and FormData() defined?

Tags:

react-native

I'm using react-native and standardjs.

Standard reports that both fetch and FormData are undefined when I use them, which is true. However, I can't figure out where either of these symbols are defined. I can't seem to import them from either react or react-native modules.

What import statement should I use to import fetch and FormData?

like image 644
emmby Avatar asked Jun 21 '16 20:06

emmby


1 Answers

fetch and FormData are provided as global polyfill for react-native. https://facebook.github.io/react-native/docs/network.html#content

Something like this to your package.json will prevent standardjs complaining about undefined variables

{
  "standard": {
    "globals": [ "fetch", "FormData" ]
  }
}
like image 128
agenthunt Avatar answered Nov 15 '22 12:11

agenthunt