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

class Counter extends Component {
  constructor() {
    super();
    this.state = { counter: 0 };
    
    this.increment = this.increment.bind(this);
    this.decrement = this.decrement.bind(this);
  }

  increment() {
    this.setState({ counter: this.state.counter + 1 });
  }

  decrement() {
    this.setState({ counter: this.state.counter - 1 });
  }

  render() {
    const { counter } = this.state;
    return (
      <p>
        Clicked: {counter} times<commit_msg>Refactor react-counter example to "redux style"<commit_after>import React, { Component, PropTypes } from 'react';

const reducer = (state = { counter: 0 }, action) => {
  switch (action.type) {
    case 'INCREMENT':
      return { counter: state.counter + 1 };
    case 'DECREMENT':
      return { counter: state.counter - 1 };
    default:
      return state;
  }
};

class Counter extends Component {
  constructor() {
    super();
    this.state = { counter: 0 };
    
    this.increment = this.increment.bind(this);
    this.decrement = this.decrement.bind(this);
  }

  dispatch(action) {
    this.setState(reducer(this.state, action));
  }

  increment() {
    this.dispatch({ type: 'INCREMENT' });
  }

  decrement() {
    this.dispatch({ type: 'DECREMENT' });
  }

  render() {
    const { counter } = this.state;
    return (
      <p>
        Clicked: {counter} times
{'fraction_non_alphanumeric': 0.14859154929577464, 'fraction_numerical': 0.004929577464788733, 'mean_word_length': 2.7493403693931397, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '1551326', 'n_tokens_mistral': 464, 'n_tokens_neox': 454, 'n_words': 104}