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
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.
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.
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.
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.
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