Search code examples
reactjsecmascript-6babeljscreate-react-app

Babel does not translate Map() when using Create-React-App


I have a React App using Create-React-App. I've used the Map() datastructure included in ES6 in my app. However, in IE11 it does not work. Shouldn't Babel (under the hood of Create-React-App - I did not eject) take care of this?

If not, is there there any solution for that?


Solution

  • As others already mentioned, you are going to need a polyfill to add the functionality when it's not natively supported by the browser in question. Since you're already using Babel, the easiest way to do this is by using a Babel polyfill.

    If you don't want to add another dependency, you can use the Map polyfill found here.