componentWillMount 方法跳过函数调用
componentWillMount method skipping a function call
这是我的 componentWillMount - 方法。
componentWillMount : function(){
this.refreshFunction
this.state.autorefresh = window.setInterval(
this.refreshFunction
,30000);
}
这主要是按预期工作的,但是,第一个函数调用,因此根本不会调用行 "this.refreshFunction"。
稍后间隔中完全相同的函数调用完美无缺。
有什么想法阻止 React 执行它吗?我是 React 的新手,不知道如何追踪问题
你试过调用正确吗?
componentWillMount : function(){
this.refreshFunction();
this.state.autorefresh = window.setInterval(
this.refreshFunction
,30000);
}
这是我的 componentWillMount - 方法。
componentWillMount : function(){
this.refreshFunction
this.state.autorefresh = window.setInterval(
this.refreshFunction
,30000);
}
这主要是按预期工作的,但是,第一个函数调用,因此根本不会调用行 "this.refreshFunction"。
稍后间隔中完全相同的函数调用完美无缺。
有什么想法阻止 React 执行它吗?我是 React 的新手,不知道如何追踪问题
你试过调用正确吗?
componentWillMount : function(){
this.refreshFunction();
this.state.autorefresh = window.setInterval(
this.refreshFunction
,30000);
}