useFieldData()
A grab-all of helper values and functions to perform whatever actions you need.
If you're wanting to do something custom, you're in the right place. This is the simplest hook to use and is a great starting point.
You may wish to use useFieldValue
or useFieldErrorMessages
for better performance depending on your needs.
Like React's useContext
hook, this hook forces your component to update anytime the value, visitation, or error messages update on a field.
Props
Props in
Props out
When to use?
Whenever you want to do something custom in OneForm related to a field, this hook is important.
OneForm handles a ton of state for you, so hooks like this aren't required.
If you can find a good use case for this hook, contact us so we can update the docs.
Creating a custom field component
If you want to create a custom <Field />
component, look at useField
instead:
Last updated