您的位置:首页 > 移动开发 > Objective-C

Expected onClick listener to be a function, instead got type object

2017-06-20 17:59 549 查看
You need to remove the quotes.
<li onClick={this.pageUp.bind(this)}>...


In vanilla javascript you would probably have onclick="somefunctionname". But not in JSX, yo need to pass a function as stated in the error.

Also, the
.bind(this)
is not necessary if you are using
React.createClass
, once you have removed the quotes you will probably get a warning stating that is not necessary since React does that for you.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: