I\'m building a site with ES6 and Babel.
In a script file, I need to make an ajax call to a service on server. For that I\'m doing like this:
fetch(\
I prefer to use isomorphic-unfetch
instead of isomorphic-fetch
, because it is able to work like a ponyfill and not a polyfill.
The difference is that it doesn't affect the rest of code and it is more transparent of the dependencies you have.
Install:
yarn add isomorphic-unfetch
Usage:
// using ES6 modules
import fetch from 'isomorphic-unfetch';
// using CommonJS modules
var fetch = require('isomorphic-unfetch');