Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <script src="https://fb.me/react-with-addons-0.14.7.min.js"></script>
  <script src="https://fb.me/react-dom-0.14.7.min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <h2>Life cycle methods</h2>
  <div id="app">
    
  </div>
</body>
</html>
 
class Hello extends React.Component {
  componentWillMount() {
    console.log('Will: before mount');
  }
  componentDidMount() {
    console.log('Did: after mount');
  }
  componentWillUnmount() {
    console.log('Will: before unmount');
  }
  
  render() {
    return (
      <div>
        Hello world
      </div>
    );
  }
}
let appEl = document.getElementById('app');
ReactDOM.render(<Hello />, appEl);
// setTimeout(() =>{
//   ReactDOM.unmountComponentAtNode(appEl);
// }, 1000);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
rkotzepro
0viewers