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