Created
July 7, 2016 05:07
-
-
Save AnthonyDS/974b1952a1501f14701faea623449b27 to your computer and use it in GitHub Desktop.
React.js - Удаление компонента из DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
export default class MyComponent extends React.Component { | |
_destroy = (e) => { | |
// - Удаление компонента из DOM | |
ReactDOM.unmountComponentAtNode(document.body); | |
} | |
render() | |
{ | |
return ( | |
<div className="button space" onClick={this._destroy.bind(this)}> | |
{'Destroy Me'} | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment