xuyingjie / fragment

Blog Tool
MIT License
1 stars 0 forks source link

React v0.14 #1

Open xuyingjie opened 8 years ago

xuyingjie commented 8 years ago

http://facebook.github.io/react/blog/2015/10/07/react-v0.14.html

var React = require('react');
var ReactDOM = require('react-dom');

var MyComponent = React.createClass({
  render: function() {
    return <div>Hello World</div>;
  }
});

ReactDOM.render(<MyComponent />, node);
var Zoo = React.createClass({
  render: function() {
    return <div>Giraffe name: <input ref="giraffe" /></div>;
  },
  showName: function() {
    // Previously: var input = this.refs.giraffe.getDOMNode();
    var input = this.refs.giraffe;
    alert(input.value);
  }
});