formik
Installation#
API#
EnhancedFormik / useEnhancedFormik#
These wrappers do a few things:
- handle reporting errors to Sentry
- adds
initialStatusfor form errors - adds
setFormSuccessandsetFormErrorhelpers - adds
applyErrorsToFieldshelper
EnhancedFormik#
useEnhancedFormik#
setFormSuccess / setFormError#
Note that setFormError accepts a sentryEventId as the second property, which will be available on
form status.
You can use Sentry.showReportDialog(status.sentryEventId) to show a report error dialog to the
user.
applyErrorsToFields#
applyErrorsToFields also accept a second optional argument of form { mapFieldName }. It is a
function used when the FE and BE field names don't match.
EnhancedField / useEnhancedField#
Enhancement that allows you to hide field errors when the input gains focus. It does this by setting
meta.touched to false.