关于Uncaught TypeError: nt.setState.bind is not a function报错解决

Posted minydong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于Uncaught TypeError: nt.setState.bind is not a function报错解决相关的知识,希望对你有一定的参考价值。

技术图片

错误代码如下:

1 show = (arg1, arg2) => {
2     this.setState = ‘456‘ + arg1 +arg2
3   }

setState是个方法,这里变成给this(实例)添加属性,手误报错!!!

正确代码如下:

1 show = (arg1, arg2) => {
2     this.setState({
3       msg: ‘456‘ + arg1 +arg2
4     })
5   }

 

以上是关于关于Uncaught TypeError: nt.setState.bind is not a function报错解决的主要内容,如果未能解决你的问题,请参考以下文章

JavaScript异常报错处理:Uncaught TypeError: xxx is not a function

Uncaught (in promise) TypeError: Cannot set properties of null (setting 'innerText') in OpenWetherMa

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'fingerprint') Laravel Live

如何解决问题:Uncaught (in promise) TypeError: promisify is not a function?

Uncaught TypeError

Uncaught TypeError: Cannot redefine property: $router