-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Line 17 in b937d87
| const { invalid } = useFormFieldSnapshot(field) |
FormFieldValid is now implemented with useSnapshot which means it will render on keystrokes. We could add another hook that prevents these unneeded renders, something like this:
function useFormFieldInvalid(field) {
const [formFieldInvalid, setFormFieldInvalid] = React.useState(() => snapshot.get(field).invalid)
React.useEffect(
() => {
setFormFieldInvalid(snapshot.get(field).invalid)
return snapshot.subscribe(field, x => setFormFieldInvalid(x.invalid))
},
[field]
)
return formFieldInvalid
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request