form icon indicating copy to clipboard operation
form copied to clipboard

formInstance.setValues does not take an updater function

Open rr-tommy-tan opened this issue 5 years ago • 0 comments

for formInstance.setValues the docs say If a callback is passed, it will be given the previous value and be expected to return a new one, similar to React's setState callback style.

currently, it does not take a callback as seen below.

code:

  const setValues = React.useCallback(
    values => {
      setState(old => ({
        ...old,
        values: values,
      }))
    },
    [setState]
  )

PR has been created to add the callback here: https://github.com/tannerlinsley/react-form/pull/379

rr-tommy-tan avatar Jun 17 '20 02:06 rr-tommy-tan