問題:
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