'IE 11 react 'promise' is undefined

I am trying to load a page which is built using react. when the page loads there is a table which is rendered using react. this table doesn't load currently on IE and throws error promise is not defined. the exact same code with promise works on other browsers. below is the code.

fetchData(url) {
    // Return a new promise.
    return new Promise(function (resolve, reject) {
        $.ajax(
            {
                url: url,
                cache: false,
                context: this,
                dataType: 'json',   // we're expecting JSON as a response
                data: {},
                method: "GET",
                contentType: "application/json; charset=utf-8",
                success: function (data, status, xhr) {
                    resolve(JSON.parse(data));
                },
                error: function (xhr, status, httpErrorText) {
                    reject(httpErrorText);
                }
            });
    });
}

any ideas why this is happening and how to fix this.



Solution 1:[1]

I had the same issue. I added the following line in public/index.html which fixed all IE11 polyfills and it worked:

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Victor Karangwa