Closed peeke closed 4 years ago
@peeke I have filled in the implementation and slightly changed the name from useFieldValues
to useFieldsValues
(not sure if you agree)
I also removed FormObjectField
and FormArrayField
as I realized that these will always be domain specific.
Before we can release we need to add the new fields to the documentation.
@EECOLOR Agreed, we're accessing multiple values from multiple forms so useFieldsValues
makes sense.
I'll see if I have some time to update the docs this week.
@EECOLOR Is see I missed a rename earlier: useFieldState
should be useFormFieldState
to be consistent with the naming of other hooks. Since they are undocumented, can we rename them? Maybe as a separate PR.
@EECOLOR What happens if you want to render 0 as a value? Right now it would return null
. Should we change the check here?
export function FormFieldValue({ field, render }) {
const value = useFormFieldValue(field)
return render(value) || null
}
Since they are undocumented, can we rename them? Maybe as a separate PR.
Yes, separate pull request and major version change.
What happens if you want to render 0 as a value? Right now it would return null. Should we change the check here?
Yes, we should
Added suggestions for the render prop components, along with some (naive) implementations. This can serve as a starting point for discussion.