2
所以,讓我們假設我有一些簡單的有一個返回渲染:如何,我只卸載其中一個孩子在this.props.children
<Sample>
{this.props.children}
</Sample>
現在讓我們來調用此組件Example
,讓通一些孩子道具吧:
<Example>
<ChildA />
<ChildB />
</Example>
現在可以說,我想卸載(因此調用componentWillUnmount()
)ChildB
。你會怎麼做呢?