You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ Universal WHATWG Fetch API for Node, Browsers and React Native. The scenario tha
10
10
-**Optional polyfill**: it's up to you if something is going to be added to the global object or not
11
11
-**Simple import**: no configuration required
12
12
-**WHATWG compliant**: it should be working the same way wherever your code runs
13
+
-**Updated**: lastest version of whatwg-fetch and node-fetch used
13
14
-**Small**: 2.5kb gzipped
14
15
15
16
@@ -120,12 +121,17 @@ I did a lot of research in order to find a fetch library that could be simple, c
120
121
121
122
#### Why not isomorphic-fetch?
122
123
123
-
My preferred library used to be [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) but it has this [bug](https://github.com/matthew-andrews/isomorphic-fetch/issues/125) that prevents it from running in a react native environment. It seems it will never be fixed since the author hasn't been commiting for a year. Also, polyfilling is mandatory.
124
+
My preferred library used to be [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) but it has this [bug](https://github.com/matthew-andrews/isomorphic-fetch/issues/125) that prevents it from running in a react native environment. It seems it will never be fixed since the author hasn't been commiting for more than a year. That means dependencies are outdated as well.
124
125
125
126
126
-
#### How does it work?
127
+
###Why polyfill might not be a good ideia?
127
128
128
-
cross-fetch (like isomorphic-fetch) is just a proxy. If you're in node, it delivers you the [node-fetch](https://www.npmjs.com/package/node-fetch) library, if you're in a browser ou React Native, it delivers you the github's [whatwg-fetch](https://github.com/github/fetch/). The same strategy applies whether you're using polyfill or ponyfill.
129
+
In a word? Risk. If the spec changes in the future, it might be problematic to debug. Read more about it on [sindresorhus's ponyfill](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills) page. It's up to you if you're fine with it or not.
130
+
131
+
132
+
#### How does cross-fetch work?
133
+
134
+
Just like isomorphic-fetch, it is just a proxy. If you're in node, it delivers you the [node-fetch](https://www.npmjs.com/package/node-fetch) library, if you're in a browser ou React Native, it delivers you the github's [whatwg-fetch](https://github.com/github/fetch/). The same strategy applies whether you're using polyfill or ponyfill.
0 commit comments