我有一些可以呈现组件的代码:
ReactDOM.render(myComponent, domNode)是否调用它取决于用户的操作。
稍后,我想要检测myComponent是否真的被渲染了,如果是的话,就删除它。目前我正在做的是:
if domNode.childNodes.length > 0
ReactDOM.unmountComponentAtNode(domNode)对树中存在的组件进行测试的React方法是什么?(不使用TestUtils)。
发布于 2016-02-13 02:54:12
为myComponent分配ref
<myComponent ref="sapyC" />
if !domNode.refs.sapyC
ReactDOM.unmountComponentAtNode(domNode)https://stackoverflow.com/questions/35369957
复制相似问题