Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between `isomorphic-fetch` and `isomorphic-unfetch` npm packages

I see both are used for SSR. So what's the difference? Apart from isomorphic-fetch being older and slightly larger gzipped package.

Links:

Isomorphic Unfetch

Isomorphic Fetch

like image 917
Somjit Avatar asked Apr 28 '20 15:04

Somjit


People also ask

Which is better node-fetch or isomorphic-f fetch?

When comparing those packages you notice that node-fetch is the more popular package today ( 7,194 Stars on Github ). isomorphic-fetch has fewer dependencies, fewer open issues and more followers on Github.

What is the difference between WHATWG-fetch and the unfetch package?

The whatwg-fetch package is an almost complete polyfill for fetch API, but the unfetch is built with "bundle size" as the first priority in mind (like the other packages written by Jason Miller such as preact ). The unfetch only supports a subset of the full fetch API.

What is the difference between isomorphic-fetch and request-promise?

request-promise has been out there for longer (since 7 years ago), it also has a bigger community of maintainers and fewer open pull requests. In our review isomorphic-fetch got 13,314,748 points, node-fetch got 73,701,728 points and request-promise got 5,573,069 points.


Video Answer


1 Answers

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.

So their difference is only in the client and the question reduces to: What's the difference between whatwg-fetch and unfetch?

The whatwg-fetch package is an almost complete polyfill for fetch API, but the unfetch is built with "bundle size" as the first priority in mind (like the other packages written by Jason Miller such as preact). The unfetch only supports a subset of the full fetch API. However, it's great if you just need simple requests in your application.

A good strategy for new applications is to use unfetch at first, and replace it with whatwg-fetch if you need any feature (such as streaming) which is not supported in unfetch.

like image 51
Hossein Moradi Avatar answered Oct 02 '22 20:10

Hossein Moradi