I've seen two different fetch here:
https://github.com/github/fetch
https://github.com/matthew-andrews/isomorphic-fetch
Can someone tell me the difference between the two?
PS: I've read the README.md but I still didn't get the difference. Last time I checked, Isomorphic means it has similar form or relation. It still doesn't make sense to me.
The Isomorphic fetch function is a Promise-based mechanism for programmatically making web requests in the browser. In browsers, we don't have a fetch function, so the FETCH polyfill adds the fetch function to the window object.
fetch() function. In NodeJS, several packages/libraries can achieve the same result. One of them is the node-fetch package. node-fetch is a lightweight module that enables us to use the fetch() function in NodeJS, with very similar functionality as window.
The isomorphic-fetch is built on top of whatwg-fetch and isomorphic-unfetch is built on top of unfetch. What both of them are doing is switching between node-fetch and the other package for client and server.
Axios is isomorphic, fetch is not The syntax for most basic Axios requests is the same in both Node. js and the browser. Since Node. js does not have a built-in fetch() function, you need to use a polyfill like node-fetch.
FETCH is polyfill for browsers which don't have fetch function (caniuse.com/#search=fetch). It will add fetch function to your browser window object.
While isomorphic-fetch is implementation of fetch for both node.js and browser, built on top of fetch polyfill.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With