Skip to content Skip to sidebar Skip to footer

Typeerror: _this2.setstate Is Not A Function, Cant Bind State

I am getting this this error. As I am already using ES6 format, That arrow but also getting same error. And somewhat confuse that how to use bind. How can I get out of this error.

Solution 1:

Just to be clear about which this you're trying to reference, could you do this?

async fetchData() { const ctx = this

And then reference ctx instead of this:

ctx.setState({ ver: responseData.results.appversion, });

Post a Comment for "Typeerror: _this2.setstate Is Not A Function, Cant Bind State"