setstate时,老是报错Cannot read property 'dataSource' of undefined.
出错代码
fetchData() {
var query = new AV.Query('TestObject');
query.find().done(function (results) {
this.setState({
dataSource: this.state.dataSource.cloneWithRows(results)
});
}).fail(function (error) {
alert('错误'+error.message)
}).always(function (a) {
})
}
我已经在constructor中
this.state = {
dataSource: new ListView.DataSource({
rowHasChanged: (row1, row2) => row1 !== row2,
})
}
实在无法定位错误,万望相助。