Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <script src="https://fb.me/react-0.13.3.js"></script>
</head>
<body>
</body>
</html>
 
// 1. Bind handleIncrementClick and handleDecrementClick to their app corresponding buttons
// 2. Implement handleIncrementClick using setState
// 3. Implement handleDecrementClick using setState
var NumberSelector = React.createClass({
  getInitialState () {
    return { number: 0 };
  },
  
  handleIncrementClick () {
    // code for 2
  },
  
  handleDecrementClick () {
    // code for 3
  },
  
  render () {
    return <div style={{width: 70, textAlign: "center"}}>
      <h2>{this.state.number}</h2>
      <button /* code for 1 */>-</button>
      <button /* code for 1 */}>+</button>
    </div>;
  }
});
React.render(<NumberSelector />, document.body);
Output

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

Dismiss x
public
Bin info
chantasticpro
0viewers