This is the button where i called the handleClick function. I think the onClick event isn't working properly (only works if i equal it to console.log('button clicked)
which logs the string to the console.)未捕获的错误:预期的onClick监听器是一个函数,而不是得到了字符串类型
This is the handleClick()
function which passes the value to the property of the component.
我不知道为什么它不工作。以前,onClick自动启动,但现在它没有这个问题。 P:我尝试了一个IIFE int onCLick事件,它仍然将消息记录到控制台,但它似乎不适用于handleClick()
。
在此先感谢。 :)
任何机会你可以张贴代码本身,而不是图像..? –
如果可以的话,请发布这个完整的组件...这将是非常有用的搞清楚什么'this.props.onClick()'应该做的... – OneNeptune
@KarlReid实际上它是一个非常长的代码,所以它没有无法发布整个代码。 –