<commit_before>const { Component } = React;
const { connect } = ReactRedux;

// AddTodo ========================================================
let nextTodoId = 0;
let AddTodo = ({ dispatch }) => {
  let input;
  return (
    <div>
        <input type="text" 
          ref={node => {
            input = node;
          }} 
        />
        <button 
          onClick={() => {
            dispatch({
              type: 'ADD_TODO',
              text: input.value,
              id: nextTodoId++
            });
            input.value =  '';
          }}
        >
        Add TODO
        </button>
    </div>
  )
}
AddTodo = connect()(AddTodo);

// VisibleTodoList ===============================================
const mapStateToTodoListProps = (state) => {
  return {
    todos: getVisibleTodos(
      state.todos,
      state.visibilityFilter
    )
  }
}
const mapDispatchToTodoListProps = (dispatch) => {
  return {
    onTodoClick : (id) => {
      dispatch({
        type: 'TOGGLE_TODO',
        id
      });
    }
  }
}
const VisibleTodoList = connect(
  mapStateToTodoListProps,
  mapDispatchToTodoListProps
)(TodoList);

// FilterLink =====================================================
class FilterLink extends Component {
  componentDidMount() {
    const { store } = this.context;
    this.unsubscribe = store.subscribe(() => {
      this.forceUpdate();
    })
  }

  componentWillUnmount() {
    this.unsubscribe();
  }
  
  render() {
    const props = this.props;
    const { store } = this.context;
    const state = store.getState();

    return (
      <Link 
        active = { 
          props.filter === state.visibilityFilter
        }
        onClick = {() => {
          dispatchSetVisibilityFilter(store, props.filter)
        }}
      >
      { props.children }
      </Link>
    );
  }
}
FilterLink.contextTypes = {
  store: React.PropTypes.object
};<commit_msg>Generating containers with connect from React-Redux (FooterLink)<commit_after>const { Component } = React;
const { connect } = ReactRedux;

// AddTodo ========================================================
let nextTodoId = 0;
let AddTodo = ({ dispatch }) => {
  let input;
  return (
    <div>
        <input type="text" 
          ref={node => {
            input = node;
          }} 
        />
        <button 
          onClick={() => {
            dispatch({
              type: 'ADD_TODO',
              text: input.value,
              id: nextTodoId++
            });
            input.value =  '';
          }}
        >
        Add TODO
        </button>
    </div>
  )
}
AddTodo = connect()(AddTodo);

// VisibleTodoList ===============================================
const mapStateToTodoListProps = (state) => {
  return {
    todos: getVisibleTodos(
      state.todos,
      state.visibilityFilter
    )
  }
}
const mapDispatchToTodoListProps = (dispatch) => {
  return {
    onTodoClick : (id) => {
      dispatch({
        type: 'TOGGLE_TODO',
        id
      });
    }
  }
}
const VisibleTodoList = connect(
  mapStateToTodoListProps,
  mapDispatchToTodoListProps
)(TodoList);

// FilterLink =====================================================
const mapStateToLinkProps = (state, ownProps) => {
  return {
    active :  
      ownProps.filter === state.visibilityFilter
  };
}

const mapDispatchToLinkProps = (dispatch, ownProps) => {
  return {
    onTodoClick : () => {
      dispatch({
        type: 'SET_VISIBILITY_FILTER',
        filter: ownProps.filter
      });
    }
  }
}
const FilterLink = connect(
  mapStateToLinkProps,
  mapDispatchToLinkProps
)(Link);
{'fraction_non_alphanumeric': 0.20468488566648077, 'fraction_numerical': 0.0005577244841048522, 'mean_word_length': 2.1520210896309315, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 32, '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': '6984923', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1056, 'n_words': 195}