这是我的componentWillMount - Method。
componentWillMount : function(){
this.refreshFunction
this.state.autorefresh = window.setInterval(
this.refreshFunction
,30000);
}
这主要是按预期工作,但是,第一个函数调用,所以,行" this.refreshFunction"永远不会被召唤。
在稍后的时间间隔内完全相同的函数调用是完美的。
有什么想法让React不执行它?我对React不太了解,也不知道如何追查问题
答案 0 :(得分:6)
您是否尝试过正确调用它?
componentWillMount : function(){
this.refreshFunction();
this.state.autorefresh = window.setInterval(
this.refreshFunction
,30000);
}