final-form-set-field-data
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/final-form-set-field-data package

    1.0.2 • Public • Published

    🏁 Final Form Set Field Data

    NPM Version NPM Downloads Build Status codecov.io styled with prettier

    Mutator for setting arbitrary metadata for fields in 🏁 Final Form.


    Installation

    npm install --save final-form-set-field-data

    or

    yarn add final-form-set-field-data

    Usage

    import { createForm } from 'final-form'
    import setFieldData from 'final-form-set-field-data'
     
    // Create Form
    const form = createForm({
      mutators: { setFieldData },
      onSubmit
    })
     
    form.mutators.setFieldData('firstName', { awesome: true })
     
    form.registerField(
      'firstName',
      fieldState => {
        const { awesome } = fieldState.data // true
      },
      {
        // ...other subscription items
        data: true
      }
    )

    Mutator

    form.mutators.setFieldData(name: string, values: Object) => void

    Merges the values provided into the data value for the specified field

    Keywords

    none

    Install

    npm i final-form-set-field-data

    DownloadsWeekly Downloads

    8,074

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    9.42 kB

    Total Files

    10

    Last publish

    Collaborators

    • erikras