Object doesn’t support property or method ‘includes’ in IE

Today we will show you how to fix the error Object doesn’t support property or method ‘includes’ generated in IE during the react development.

Object doesn’t support property or method ‘includes’ in IE react, includes() not working in all browsers, IE 11 issue – .includes() is not supported, IE11: Object doesn’t support property or method ‘includes’, Alternative of .includes() in Internet Explorer, Crash in IE11 for javascript usage of “includes”.

If you look at the documentation of includes(), most of the browsers don’t support this property.

Way to Fixed the error: Object doesn’t support property or method ‘includes’ in IE

  1. Use indexOf instead of includes
  2. Use the polyfill

1. Use indexOf instead of includes

You can use widely supported indexOf() after converting the property to string using toString():

2. Use the polyfill

You can also use the polyfill from MDN. Add below script on top of the all imports and it will work.

Solution 1:

In alternative way you can use below script as well.

Solution 2:

Output:

I have created a new file as “polyfill.js” and added above script to load React Application in IE. Your react application’s index.js page should look like below.

index.js

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *