什麼是 {this.props.children} 以及何時應該使用它? - What is {this.props.children} and when you should use it?

問題:

Being a beginner to React world, I want to understand in depth what happens when I use {this.props.children} and what are the situations to use the same.作爲 React 世界的初學者,我想深入瞭解使用{this.props.children}時會發生什麼以及使用它的情況。 What is the relevance of it in below code snippet?它在下面的代碼片段中有什麼相關性?

render() {
  if (this.props.appLoaded) {
    return (
      <div>
        <Header
          appName={this.props.appName}
          currentUser={this.props.currentUser}
        />
        {this.props.children}
      </div>
    );
  }
}

解決方案:

參考一: https://en.stackoom.com/question/3MZ0x
參考二: https://stackoom.com/question/3MZ0x
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章