<commit_before>import React from 'react';
import { movePiece } from '../actions';
import { connect } from 'react-redux';
import _ from 'lodash';
import { getPieceImage } from '../images/shogiPieces/index';

const mapStateToProps = (state) => {
  return {
    board: state.board,
    turn: state.turn
  };
};

const mapDispatchToProps = (dispatch) => {
  return {
    onPieceClick: (board, piece) => {
      dispatch(movePiece(board, piece));
    }
  };
};

export default class ShogiPiece extends React.Component {
  render() {
    return(
      <div className="piece" onClick={() => this.props.onPieceClick(this.props.board, this.props.piece)}>
        <img src={getPieceImage(this.props.piece)}></img>
      </div>
    );
  }
}

const Piece = connect(
  mapStateToProps,
  mapDispatchToProps
)(ShogiPiece);

export default Piece;<commit_msg>Use function instead of React Component Class<commit_after>import React from 'react';
import { movePiece } from '../actions';
import { connect } from 'react-redux';
import _ from 'lodash';
import { getPieceImage } from '../images/shogiPieces/index';

const mapStateToProps = (state) => {
  return {
    board: state.board,
    turn: state.turn
  };
};

const mapDispatchToProps = (dispatch) => {
  return {
    onPieceClick: (board, piece) => {
      dispatch(movePiece(board, piece));
    }
  };
};

const shogiPiece = ({ piece, board, onPieceClick }) => {
  return (
    <div className="piece" onClick={() => onPieceClick(board, piece)}>
      <img src={getPieceImage(piece)}></img>
    </div>
  );
};

const Piece = connect(
  mapStateToProps,
  mapDispatchToProps
)(shogiPiece);

export default Piece;
{'fraction_non_alphanumeric': 0.15351941747572814, 'fraction_numerical': 0.0, 'mean_word_length': 3.7249283667621778, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, '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': '4711288', 'n_tokens_mistral': 551, 'n_tokens_neox': 543, 'n_words': 125}