JSPM

final-form-set-field-data

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 51401
  • Score
    100M100P100Q173787F
  • License MIT

Mutator for setting arbitrary metadata on fields in 🏁 Final Form

Package Exports

  • final-form-set-field-data

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (final-form-set-field-data) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

🏁 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