<commit_before>import React, {PropTypes} from 'react';
import { findDOMNode } from 'react-dom';

let nextEntityId = 0;
class CmsApp extends React.Component {
  constructor(props) {
    super(props);
    this.props.actions.addEntity = this.props.actions.addEntity.bind(this);
    this.save = this.save.bind(this);
    this.mapEntity = this.mapEntity.bind(this);
    this.validate = this.validate.bind(this);
    this.settings = {};
  }

  save() {
    this.props.actions.addEntity(this.props.cmsAppState, this.settings.text, nextEntityId++);
    this.settings = {};
    findDOMNode(this.refs.text).value = "";
  }

  toggle() {
    this.props.actions.toggleEntity(this.props.cmsAppState);
  }

  mapEntity(entity) {
    return (<li key={entity.id}>{entity.text}</li>);
  }

  validate(e) {
    this.settings.text = e.target.value;
    return true;
  }

  render() {
    return (
      <div>
        <ul>
          {this.props.cmsAppState.map(this.mapEntity)}
        </ul>
        <div><input ref="text" type="text" value={this.settings.text} onChange={this.validate}/><input type="submit"
                                                                                                       value="Save"
                                                                                                       onClick={this.save}/>
        </div>
      </div>
    );
  }
}

CmsApp.propTypes = {
  actions: PropTypes.object.isRequired,
  cmsAppState: PropTypes.array.isRequired
};

export default CmsApp;
<commit_msg>Bind input node to this.input<commit_after>import React, {PropTypes} from 'react';

let nextEntityId = 0;
class CmsApp extends React.Component {
  constructor(props) {
    super(props);
    this.props.actions.addEntity = this.props.actions.addEntity.bind(this);
    this.save = this.save.bind(this);
    this.mapEntity = this.mapEntity.bind(this);
    this.validate = this.validate.bind(this);
    this.settings = {};
  }

  save() {
    this.props.actions.addEntity(this.props.cmsAppState, this.input.value, nextEntityId++);
    this.settings = {};
    this.input.value = "";
  }

  toggle() {
    this.props.actions.toggleEntity(this.props.cmsAppState);
  }

  mapEntity(entity) {
    return (<li key={entity.id}>{entity.text}</li>);
  }

  validate(e) {
    this.settings.text = this.input.value;
    return true;
  }

  render() {
    return (
      <div>
        <ul>
          {this.props.cmsAppState.map(this.mapEntity)}
        </ul>
        <div><input ref={node => {this.input = node;}} type="text" value={this.settings.text}
                    onChange={this.validate}/><input type="submit"
                                                     value="Save"
                                                     onClick={this.save}/>
        </div>
      </div>
    );
  }
}

CmsApp.propTypes = {
  actions: PropTypes.object.isRequired,
  cmsAppState: PropTypes.array.isRequired
};

export default CmsApp;

{'fraction_non_alphanumeric': 0.14436860068259386, 'fraction_numerical': 0.0006825938566552901, 'mean_word_length': 2.06269592476489, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6853958', 'n_tokens_mistral': 900, 'n_tokens_neox': 881, 'n_words': 138}