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

export default class ColorPicker extends Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    const self = this;
    $(this.refs.colorPicker).spectrum({
      color: self.props.color,
      change: function (color) {
        self.props.onChangeColor(color.toHexString())
      }
    });
  }

  render() {
    return (
      <div className="color-picker">
        <input type="text" value={this.props.color} ref="colorPicker" />
      </div>
    );
  }
}<commit_msg>色の変更をsetメソッドに変更<commit_after>import React, { Component } from 'react'

export default class ColorPicker extends Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    this.$colorPicker = $(this.refs.colorPicker);

    const self = this;
    this.$colorPicker.spectrum({
      color: self.props.color,
      change: function (color) {
        self.props.onChangeColor(color.toHexString())
      }
    });
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.color != nextProps.color) {
      this.$colorPicker.spectrum("set", nextProps.color);
    }
  }

  render() {
    return (
      <div className="color-picker">
        <input type="text" ref="colorPicker" />
      </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 2.8136094674556213, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2489517', 'n_tokens_mistral': 414, 'n_tokens_neox': 401, 'n_words': 73}