Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//fb.me/react-0.13.1.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
    var Child = React.createClass({
      render: function () {
        return <a {...this.props}> {this.props.text} </a>;
      }
    });
    var Parent = React.createClass({
      getInitialState: function () {
        return {
          text: "Click here",
          text2: "No, Click here",
        };
      },
      onClick: function (text) {
        alert(text);
      },
      render: function() {
        return <div>
          <Child onClick={this.onClick.bind(null, this.state.text)} text={this.state.text} />
          <Child onClick={this.onClick.bind(null, this.state.text2)} text={this.state.text2} />
        </div>;
      }
    });
    
    React.render(<Parent />, document.body);
Output 300px

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

Dismiss x
public
Bin info
chantasticpro
0viewers