React The Milk 🥛

<div id="app"></div>
const ToDoList = React.createClass({
  getInitialState: function() {
    return {
      todoItems: [],
      newItem: ''
    };
  },
  handleEdit: function(e) {
    this.setState({newItem: e.target.value});
  },
  handleKey: function(e) {
    if (e.key === 'Enter') {
      this.handleAdd();
    }
  },
  handleAdd: function() {
    if (this.state.newItem) {
      const item = {name: this.state.newItem};
      const newItems = this.state.todoItems.concat(item);
      this.setState({todoItems: newItems});
      this.setState({newItem: ''});
      this.inputFocus();
    }
  },
  inputFocus: function() {
    document.querySelector('input[type="text"]').focus();
  },
  render: function() {
    const currentItems = this.state.todoItems.map((item, i) =>
      <li key={i}>
        {item.name}
        <button>delete</button>
      </li>
    );
    return (
      <div>
        <input
          type="text"
          value={this.state.newItem}
          onChange={this.handleEdit}
          onKeyPress={this.handleKey}
        />
        <button onClick={this.handleAdd}>add</button>
        <ul>
          {currentItems}
        </ul>
      </div>
    );
  }
});

ReactDOM.render(
  <ToDoList />,
  document.getElementById('app')
);