Unmounting React.js node

前端 未结 6 472
北海茫月
北海茫月 2020-12-07 18:36

I\'m trying to unmount a React.js node with this._rootNodeID

 handleClick: function() {

        React.unmountComponentAtNode(this.         


        
6条回答
  •  有刺的猬
    2020-12-07 19:30

    First , i am new to reactjs ,too . Of course we can control the Component all by switch the state , but as I try and test , i get that , the React.unmountComponentAtNode(parentNode) can only unmount the component which is rendered by React.render(,parentNode). So to be removed must be appened by React.render() method , so I write the code

    
    

    Run the sample code in jsFiddle , and have a try .

    Note: in the sample code React.findDOMNode is replaced by getDOMNode as the reactjs version problem .

提交回复
热议问题