<commit_before>// @flow
import React from 'react';
import PropTypes from 'prop-types';
import { Field } from 'react-final-form';
import './field-error.scss';

const FieldError = ({ name }) => (
    <Field
        name={name}
        subscription={{ touched: true, error: true }}
        render={({ meta: { touched, error } }) =>
            touched && error ? <div className="field-error">{error}</div> : null
        }
    />
);

FieldError.propTypes = {
    name: PropTypes.string.isRequired
};

export default FieldError;<commit_msg>Fix broken <FieldError /> (by unknown reason preact is ignoring functional components)<commit_after>// @flow
import React from 'react';
import PropTypes from 'prop-types';
import { Field } from 'react-final-form';
import { toClass } from 'recompose';
import './field-error.scss';

const FieldError = ({ name }) => (
    <Field
        name={name}
        subscription={{ touched: true, error: true }}
        render={({ meta: { touched, error } }) =>
            touched && error ? <div className="field-error">{error}</div> : null
        }
    />
);

FieldError.propTypes = {
    name: PropTypes.string.isRequired
};

export default toClass(FieldError);
{'fraction_non_alphanumeric': 0.15785054575986565, 'fraction_numerical': 0.0, 'mean_word_length': 3.124567474048443, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 14, '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': '3875739', 'n_tokens_mistral': 340, 'n_tokens_neox': 347, 'n_words': 95}