Field components and
handleSubmit. FormEngine stores form structure in a JSON schema and renders it through
<FormViewer>. The migration moves field definitions and validation rules from JSX/Yup into a JSON
object, and replaces Formik’s onSubmit with onActionEventAsync.
Last reviewed: April 2026.
This guide maps Formik patterns to FormEngine equivalents with before/after code. Migration is
incremental — Formik and FormEngine can coexist in the same app while you migrate form by form.
FormEngine Core is open-source on GitHub. For the full
architecture comparison, see FormEngine vs Formik.
When to migrate
Formik’s last major release was in 2021. The library is stable but sees minimal active development. Teams typically migrate when:- They want a library with active maintenance
- Forms need runtime configuration without redeployment
- Non-developers need to edit forms through a visual designer
- They want to consolidate form state into a JSON schema stored in a database
Concept mapping
| Formik | FormEngine |
|---|---|
useFormik({ initialValues, onSubmit }) | <FormViewer form={schema} onActionEventAsync={...}> |
<Field name="x" /> | Component entry in JSON schema |
<Form> / handleSubmit | submit action on a Button |
validationSchema (Yup) | validations array on each component |
<ErrorMessage name="x" /> | Built-in — FormEngine renders errors inline |
values.x | form.data.x in expressions |
touched.x | Handled internally by FormEngine |
setFieldValue | setValues action |
<FieldArray> | Repeater component in schema |
<FastField> | Not needed — FormEngine re-renders efficiently by default |
Before/after: basic form
Formik:<ErrorMessage> components needed.
Before/after: Yup validationSchema
Formik uses a top-levelvalidationSchema that defines rules for all fields. FormEngine defines rules per-component in the schema.
Formik + Yup:
Before/after: conditional fields
Formik withvalues check:
renderWhen:
Before/after: FieldArray (repeating sections)
FormikFieldArray:
Repeater:
formData.items = [{ name: '...', qty: 1 }, ...].
Before/after: setFieldValue
Formik:setValues action:
Migrating initialValues
Formik uses initialValues to pre-populate the form. In FormEngine, set the defaultValue prop on individual components:
initialData to FormViewer:
Migration strategy
Incremental (recommended):- Install FormEngine:
npm install @react-form-builder/core @react-form-builder/components-material-ui - Pick one Formik form — ideally one with straightforward validation.
- Write the JSON schema for it.
- Replace the Formik component tree with
<FormViewer>. - Move
validationSchemarules into the schema’svalidationsarrays. - Move
onSubmittoonActionEventAsync. - Test, ship, then move to the next form.
.test() rules, convert them to Zod
custom validators.
What doesn’t migrate cleanly
Formik context consumers: If you have nested components that useuseFormikContext() to read or
write form state, those need to be rewritten. In FormEngine, form state is accessed via
FormViewerRef from outside, or via form.data expressions inside the schema.
Custom async validation with validate: Formik supports a validate async function per field.
FormEngine supports async validators via validateAsync in the custom validator object — the
concept is the same, the API is different.
Formik’s isSubmitting and loading state: Formik tracks isSubmitting automatically.
FormEngine doesn’t expose a built-in submitting state — manage it in your React component’s
useState inside the onActionEventAsync handler.
Next steps
- Dynamic form from JSON tutorial — FormEngine from scratch
- Validation reference — full built-in validator list (Yup → FormEngine mapping)
- Validation with Zod — for complex validation rules
- Conditional fields tutorial — migrate Formik
values-based conditionals - Actions and events reference —
setValues, computed values, submit - Inspection and data collection forms — Repeater patterns in production
- FormEngine vs Formik — architecture comparison
- FormEngine on GitHub — MIT source code