react-rails icon indicating copy to clipboard operation
react-rails copied to clipboard

IE 11 Symbol.iterator not defined issue

Open amokasha opened this issue 9 years ago • 1 comments

Help us help you! Please choose one:

  • [x ] My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • [ ] My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • [ ] I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • [ ] I have another issue to discuss.

I'm iterating over an array in my component which throws an error on IE 11: Symbol.iterator undefined. Here is a sample of my code:

for (let item of window.items) {
  doStuff(item);
}

I found two ways to fix this. The one I used, is to convert the code to use a for loop without an iterator like so:

var arrayLength = window.items.length;
for (var i = 0; i < arrayLength; i++) {
  item = window.items[i];
  doStuff(item);
}

The second way is to include the babel polyfill from here, but I decided not to do that.

Is there any other way to fix this issue and use iterators in react-rails?

amokasha avatar Jan 25 '17 00:01 amokasha

No, react-rails doesn't include polyfills for es6 features. You should use a polyfill library or use backwards-compatible code, as you mentioned above.

rmosolgo avatar Apr 03 '17 20:04 rmosolgo