错误代码如下:
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 }