I am getting this error in IE 11 on Windows 10 TypeError: Object doesn't support property or method 'someMethod'
. I am using React and calling a method named someMethod
inside componentDidMount
in Full.js
file.
The someMethod
method is defined outside src
directory of react using jQuery externally (and not inside react like this import $ from jquery
) using <script>
tag in index.html
. And I am accessing that method in my Full.js
as follows:
componentDidMount() {
window.someMethod();
}
And that's the place I am getting the error in IE 11 and the above code is working fine in Chrome, Firefox and even in Edge but not in IE 11.
I tried hitting window
in the console of IE but I couldn't find someMethod
but it is showing in Firefox's and Chrome's console.
The someMethod
method is defined inside a file named methods.js
in code
directory outside of src
directory and I am getting the same error when calling other methods defined in this file in the following manner:
function someMethod() {
// Some code here
}
Is this is a problem with IE regarding Javascript Hoisting?
PS: I have core-js
polyfill installed in my project and I also tried declaring the someMethod
method I the following manner as well but still no luck:
var someMethod = function() {
// Some Code here
}