Validating contact form
I'm adding some dummy code here to simulate an async login call, then logging out what the values are.In the callback, I'm also calling the set Submitting function that was destructured from the second parameters.The purpose of the function is to iterate through the values of our form, validate these values in whatever way we see fit, and return an errors * Ok, you might have noticed that handling the validate logic on our own gets a bit verbose.We have to manually do all of the checks ourselves.In this case, Formik will pass properties to our form code, which is the child.Notice that I'm using destructuring to get a reference to several specific variables and functions.We recommend using Yup and you'll see why shortly.
At the end of the day though, I think we've got a pretty legit login form!
You can use Code Sandbox as well or use your local environment. Regardless of what you use for this demo, you need to start with a new React app using Create React App.
In Code Sandbox, I'm going to choose to do just that.
component to show how basic login forms are handled from scratch.
You can also use that as a reference for the form we are going to add now.