Better React Forms with Formik

Andrew Mead · 105K views · 2017 · 42:38

Open on YouTube

Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a start-to-finish walkthrough of Formik basics when they are stuck on form handling, validation or field wiring.

Recommended by 3 people across 3 different months, 2018 to 2019.

What it is

A 42-minute tutorial by Andrew Mead on building forms in React with the Formik library. It walks through wiring up inputs, handling submission and adding validation, and the final code is available for download.

What people said

Recommends Tun Tun Aung · 2018-06 · Stack Overflow · on “How to receive select value in handlesubmit function with formik react js?”

I also faced this problem yesterday. My problem was to submit form that contains ant design dropdown. I finally make it work after hours of: revisiting the Formik Docs [LINK] watch Andrew Mead's video Better React Form with Formik [this video] again. also viewing Jared Palmer's Working with 3rd-party inputs #1: react-select [LINK] The doc said you need to set onChange , onBlur events to setFieldValue , setFieldTouched props respectively like 3rd-party input example: <MySelect value={values.topics} onChange={setFieldValue} onBlur={setFieldTouched} error={errors.topics} touched={touched.topics} /> So to my problem, I need to change a bit: <Select {...field} onChange={(value) => setFieldValue('fruit

Recommends SakoBu · 2019-04 · Stack Overflow · on “Formik dispatch Redux action after valid field change”

Ok, I think I understand... in the sandbox name is missing from the input which is how Formik identifies the fields and much more.... You’d get a lot more value out of this 40 min vid than a paragraph here... here you go: [this video]

Recommends Moshe · 2019-09 · Stack Overflow · on “Higher Order Components, Props with Formik & GatsbyJS”

I am trying to create a Formik form in a Gatsby site using the withFormik higher order component (rather than use a render prop). Here is a simplified version of my code: import React from 'react' import { withFormik } from 'formik' const TestPage = ({ handleChange, values }) => ( <div> <input type="email" name="email" placeholder="Email" onChange={handleChange} value={values.email} /> </div> ) const FormikTest = withFormik({ mapPropsToValues() { return { email: 'test@test.com', } }, }) export default FormikTest(TestPage) So far, everything works just as a I want. However, I am hitting a problem when it comes to setting up a conditional argument for the email field in the mapPropsToValues ob

Cites hello world · 2018-05 · Stack Overflow · on “formik form validation not working reactjs”

following this tutorial here [this video] on formik form validation and running into an issue when implementing validation validationSchema: Yup.object().shape({ email: Yup.string().email().required(), password: Yup.string().min(6).required() }), i get no error messages on my local environment but on my codesandbox i get the following error TypeError Cannot read property 'object' of undefined which is pretty straight forward but im not knowledgable enough to debug (still new to react and formik) thanks for all the help here below is full source code & also here is a link to codesandbox [LINK] import React from 'react'; //import logo from './logo.svg'; import './App.css'; import { Button, Form, Fo