Imagine the web without forms: You can’t log in anywhere. You can’t order anything in a web shop. You can’t chat with anyone. And, you can’t even complain about it because there’s no contact form!
Forms are the backbone of many interactive web applications. Forms, and form elements in particular, are the primary way to capture user input in input fields, check boxes, drop-downs, file uploads, and a bunch more related elements.
Because forms are so important, any decent web framework has to support handling form data. React is very capable of dealing with forms. In fact, proper handling of form data was one of the earliest priorities in the React codebase because it was essential for the work React was developed for.
You can work with forms in React in one of two ways. You can let React control the state of the form and store the current values in the component state, which is the recommended and primary way. It’s the recommended way because you keep the logic and data flow inside React. Having your React application be in control of your entire application is often preferred over handing out control to other parties or applications. In this instance, you take control from the browser’s automatic form handling and let React deal with it.