Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between isomorphic-fetch and fetch?

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.

like image 624
Joshua Rajandiran Avatar asked Jun 21 '16 06:06

Joshua Rajandiran


People also ask

What does isomorphic-fetch do?

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.

Is node-fetch the same as fetch?

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.

What is isomorphic Unfetch?

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.

Is Axios isomorphic?

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.


1 Answers

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.

like image 154
Sergey Avatar answered Sep 30 '22 17:09

Sergey