react-hook-form: Why dirtyFields not updating if i make any field dirty?
Why dirty fields not updating if I make any field dirty.
Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/7o2wrp86k6
- Type into any field.
- I expect
dirtyFields
to update with the field details. - Error:
dirtyFields
is always empty.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (11 by maintainers)
updated š
I think i need to find a better term to describe the invoke, people probably gets confused.
const { dirty } = formState; // read the individual state
before the renderinstead of
return <div>{formState.dirty}</div>
Yes itās due to Proxy: https://react-hook-form.com/api#formState
also
dirtyFields
is aSet
@bluebill1049 I would like to, however I still donāt understand how to invoke the proxy to get the data to show up properly. In that sandbox dirtyFields is still showing up as an empty object for me
{}
If you post a quick example here I can edit the docs
@bluebill1049 Perhaps adding an example read and/or invocation to the documentation there to make that more clear? Iām not exactly sure what āinvokingā a Proxy would mean
please double check your console.