<commit_before>import * as React from 'react';

import { ReactComponent } from './util';

/** Executes an action when the component is mounted; the action is also fired whenever props change */
export const withExecuteOnMount =
    <TProps extends {}>(action: (state: TProps) => void) =>
    (Component: ReactComponent<TProps>) =>
    class ExecuteOnMount extends React.Component<TProps> {
        componentDidMount() { action(this.props); }
        componentWillReceiveProps(nextProps: TProps) { action(nextProps); }

        render() {
            return <Component {...this.props}/>;
        }
    };<commit_msg>simplify withExecuteOnMount<commit_after>import * as React from 'react';
import { lifecycle } from 'recompose';

import { ReactComponent } from './util';

/** Executes an action when the component is mounted; the action is also fired whenever props change */
export const withExecuteOnMount =
    <TProps extends {}>(action: (state: TProps) => void) =>
    (Component: ReactComponent<TProps>) =>
    lifecycle<TProps, {}>({
        componentDidMount: () => action(this.props),
        componentWillReceiveProps: (props) => action(props)
    })(Component);
{'fraction_non_alphanumeric': 0.13076923076923078, 'fraction_numerical': 0.0, 'mean_word_length': 3.858921161825726, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 18, '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': '1357010', 'n_tokens_mistral': 320, 'n_tokens_neox': 314, 'n_words': 97}