Chapter 5. Working with forms in React
This chapter covers
- Using forms in React
- Controlled and uncontrolled form components in React
- Validating and sanitizing data in React
By this point, you’ve gotten some basics for building simple components with React: lifecycle hooks, PropTypes, and much of the top-level component API. You’ve had a taste of the fundamentals and can do basic things like update local component state and pass data between components using props. You’ve also been introduced to component structure, ways to think in terms of components, and lifecycle methods.
In this chapter, you’ll put more of that knowledge to work and really start building out the sample app, Letters Social. You’ll be creating a component that users can use to create new posts for Letters Social. First, we’ll explore the overall problem and review the data requirements. Then we’ll talk about forms in React and you’ll build out the functionality for the component. By the end of this chapter, you’ll have learned how to use forms in your React applications.