Original Notes by Instructor Emily Seibert
Last Class
- Forms using HTML in JSX and managing form state with React
- Input, textarea, submit with submit button on form tag
- onChange and onSubmit
- computed properties
- We learned how to create a search input button that filters through results using a useEffect and react state
Today's Objectives
- use Formik to control forms
- validate user input in forms
- make POST requests to pass data collected from a form to a database
- with axios, will learn more in adv react!
Why / When to Use Formik
- Very useful when there are many forms in your application
- Managing form state — done automatically and locally to your form file
- Formik also supports Yup: the most widely adopted object validation solution for React, directly into its handlers.
- easy value parsing and error formatting, via handler functions passed into Formik
More information here: https://medium.com/@rossbulat/formik-for-react-introduction-to-form-management-done-right-971889b40f9f and in Formik docs
Guided Project
Starter Code:
https://codesandbox.io/s/github/cmgorton/formik-starter/tree/master/