Formik Forms Library

Formik Forms Library

formik.org

2

About this website

Formik is a form state management library for React created by Jared Palmer in 2017, providing form state, validation, error handling, submission, and field synchronization through a combination of render props, hooks, and higher-order components, with features including synchronous and asynchronous validation through Yup schemas or custom functions, field-level validation, form-level validation, touched state tracking, dirty state tracking, submission state tracking, nested field values, field arrays, and the Formik context for prop drilling-free field access, designed to reduce the boilerplate of building forms in React while maintaining flexibility, adopted by companies including Walmart, Microsoft, and The New York Times for their form implementations. The core useFormik hook manages form state including values, errors, touched, isSubmitting, and submitCount, with the handleChange function updating field values on input changes, the handleBlur function marking fields as touched on blur, the handleSubmit function validating and submitting the form, and the setFieldValue, setFieldError, setFieldTouched, and setValues functions for programmatic state manipulation. The validation system integrates with Yup schemas through the validationSchema prop, with Yup providing declarative validation rules including string, number, date, boolean, array, and object schemas, with custom test functions, conditional validation through the when method, and type-safe transforms, while custom validation functions receive the values object and return either an errors object or a promise for asynchronous validation. The Field, Form, ErrorMessage, and FastField components for declarative form building. The FieldArray for dynamic field lists. The connect higher-order component. The TypeScript support. The testing utilities. Designed by Jared Palmer. Designed for React developers.

Tags & Categories

Categories

Statistics

2
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!