Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//fb.me/react-with-addons-0.13.1.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div id="test"></div>
</body>
</html>
 
class Test extends React.Component {
  componentDidMount() {
    console.log("componentDidMount", this);
  }
  
  componentDidUpdate() {
    console.log("componentDidUpdate", this);
  }
  
  componentWillReceiveProps() {
    console.log("componentWillReceiveProps", this);
  }
  
  componentWillUnmount() {
    console.log("componentWillUnmount", this);
  }
  
  shouldComponentUpdate() {
    console.log("shouldComponentUpdate", this)
    return true;
  }
  
  handler() {
    console.log(this);
  }
  
  render() {
    return <p onClick={this.handler}>Hello!</p>;
  }
}
let component = React.render(<Test />, document.getElementById("test"));
setInterval(() => component.setState({ foo: 'bar'}), 5000)
setInterval(() => React.unmountComponentAtNode(document.getElementById("test")), 10000)
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers