Framework JS

ReactJS

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

ReactDOM.render(
  <h1 class="test">Hello, world!</h1>,
  document.getElementById('example')
);
var React = require('react');
var ReactDOM = require('react-dom');

ReactDOM.render(React.createElement(
  'h1',
  { 'class': 'test' },
  'Hello, world!'
), document.getElementById('example'));
ar CommentForm = React.createClass({
  getInitialState: function() {
    return {author: '', text: ''};
  },
  handleAuthorChange: function(e) {
    this.setState({author: e.target.value});
  },
  handleTextChange: function(e) {
    this.setState({text: e.target.value});
  },
  render: function() {
    return (
      <form className="commentForm">
        <input
          type="text"
          placeholder="Your name"
          value={this.state.author}
          onChange={this.handleAuthorChange}
        />
        <input
          type="text"
          placeholder="Say something..."
          value={this.state.text}
          onChange={this.handleTextChange}
        />
        <input type="submit" value="Post" />
      </form>
    );
  }
});

deck

By Jonathan Boyer

deck

  • 1,380