问题:
I have a notification component, and I have a timeout setting for it.我有一个通知组件,并且有一个超时设置。 After timeout I call this.setState({isTimeout:true})
.超时后我调用this.setState({isTimeout:true})
。
What I want to do is if already timeout, I want just render nothing:我想要做的是如果已经超时,我只想渲染什么:
render() {
let finalClasses = "" + (this.state.classes || "");
if (isTimeout){
return (); // here has some syntax error
}
return (<div>{this.props.children}</div>);
}
The problem is:问题是:
return ();返回 (); // here has some syntax error // 这里有一些语法错误
解决方案:
参考一: https://en.stackoom.com/question/2qZkz参考二: https://stackoom.com/question/2qZkz