No matter what kind of app you’re writing, there’s a good chance you need at least one form.
Forms in React are often a pain, filled with verbose and boilerplate-y code.
Let’s look at how to make forms in React with less pain.
In this article we’ll be focusing on using plain React, with no libraries. You’ll learn how forms really work, so you can confidently build them yourself. And if later you choose to add a form library, you’ll know how they work under the hood.
We’re going to cover:
- How to create React forms without installing any libraries
- The two styles of inputs in React forms
- When to use Controlled vs. Uncontrolled inputs
- An easy way to get values out of uncontrolled inputs