<commit_before>import React from 'react'
import { FormProvider } from './createFormProvider'

class Field extends React.Component {
  /**
   * Component responsible to manage the behavior of field. It get
   * a context received by FormProvider and pass like props to
   * render component.
   */

  getFieldProps (fieldName) {
    const { form: { fields } } = this.context
    const field = fields[fieldName]
    return {
      name: field.name,
      value: field.value,
      onChange: field.onChange
    }
  }

  render () {
    const { name, component: Component, ...inputProps } = this.props
    return <Component {...this.getFieldProps(name)} {...inputProps} />
  }
}

Field.contextTypes = FormProvider.childContextTypes

export default Field<commit_msg>chore(createForm): fix props passed by Field<commit_after>import React from 'react'
import { FormProvider } from './createFormProvider'

class Field extends React.Component {
  /**
   * Component responsible to manage the behavior of field. It get
   * a context received by FormProvider and pass like props to
   * render component.
   */

  getFieldProps (fieldName) {
    const { form: { fields } } = this.context
    const field = fields[fieldName]
    return {
      ...field,
      value: field.value || ''
    }
  }

  render () {
    const { name, component: Component, ...inputProps } = this.props
    return <Component {...this.getFieldProps(name)} {...inputProps} />
  }
}

Field.contextTypes = FormProvider.childContextTypes

export default Field
{'fraction_non_alphanumeric': 0.10994075049374588, 'fraction_numerical': 0.0, 'mean_word_length': 3.086021505376344, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4204340', 'n_tokens_mistral': 425, 'n_tokens_neox': 421, 'n_words': 133}