我正在学习React,现在,我正在尝试将一个onClick事件添加到我的按钮中,当单击该事件时,它将显示一个从Rest中获取的笑话。我读了这些文档,它说要发生onclick事件,您需要调用您使用的函数,在本例中是componentDidMount。我最初使用了{this.componentDidMount},得到了以下错误消息:Cannot read property 'setState' of
我已经创建了一个列表视图来在屏幕上显示数据库的所有内容。我使用的代码是这样的// Get all of the notes from the database and create the item list(this, R.layout.notes_row, c, from, to); }
它在使用下面的代码之前是有效