Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<div id="container"></div>
 
let Button = React.createClass({
  _onClick: function(e){
    e.preventDefault();
    this.props.onClick(e, this)
  },
  getSomeAttr: function(){
    return this.props.someAttr;
  },
  render : function() {
    return (
      <button onClick={this._onClick}>
        Send Message
        <span> INSIDE SPAN </span>
        <span className = "sendMsgIcon"> ICON </span>
      </button>
    );
  }
});
let MY = React.createClass({
 sendMsg : function(e, btn){
     alert(btn.getSomeAttr());
 },
  render: function() {
    return (
      <Button someAttr="10" onClick={this.sendMsg}/>
    );
  }
});
ReactDOM.render(
  <MY />,
  document.getElementById("container")
);   
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers