<commit_before>import React, { Component, PropTypes } from 'react';

const ENTER_KEY_CODE = 13;

export default class TodoInput extends Component {
  static propTypes = {
    createTodo: PropTypes.func.isRequired,
  }

  onEnter = (e) => {
    const { createTodo } = this.props;
    const { input } = this.refs;

    if (!input.value.length) return;

    if (e.keyCode === ENTER_KEY_CODE) {
      createTodo({ text: input.value });
      input.value = '';
    }
  }

  render() {
    return (
      <input
        ref="input"
        type="text"
        onKeyDown={this.onEnter}
        autoFocus="true"
      />
    );
  }
}<commit_msg>Update TodoInput to use ref callback<commit_after>import React, { Component, PropTypes } from 'react';

const ENTER_KEY_CODE = 13;

export default class TodoInput extends Component {
  static propTypes = {
    createTodo: PropTypes.func.isRequired,
  }

  onEnter = (e) => {
    const { createTodo } = this.props;

    if (!this._input.value.length) return;

    if (e.keyCode === ENTER_KEY_CODE) {
      createTodo({ text: input.value });
      input.value = '';
    }
  }

  render() {
    return (
      <input
        ref={(input) => { this._input = input }}
        type="text"
        onKeyDown={this.onEnter}
        autoFocus="true"
      />
    );
  }
}
{'fraction_non_alphanumeric': 0.13702848344880678, 'fraction_numerical': 0.003079291762894534, 'mean_word_length': 2.4120734908136483, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2547613', 'n_tokens_mistral': 437, 'n_tokens_neox': 426, 'n_words': 92}