class Videos extends React.Component{
constructor(){
super();
videoslist:[];
}
_getVideo(skip,limit){
var self= this;
var sess=localStorage.getItem("sessionId");
$.ajax({
method:'GET',
url:'videos',
data:{'sessionId':sess,
'skip':skip,
'limit':limit},
success:function(res){
this.setState({videoslist:res.data})
}.bind(this)
});
}
componentWillMount(){
this._getVideo(0,10);
}
未捕获的TypeError:无法读取属性' videoslist' of null Uncaught TypeError:无法读取属性' _currentElement'为null
答案 0 :(得分:1)
你的状态初始化错误
constructor(){
super();
this.state = {
videoslist: []
}
}