react-rails
react-rails copied to clipboard
IE 11 Symbol.iterator not defined issue
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-railswith 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?
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.