Loading tutorials
onChange and onSubmit. This chapter explains how those handlers work. Later chapters build controlled inputs on top of them.5 min readuseState once. It covers how to keep what a user types in component state, and how that state behaves. The next chapter explains why an input needs both value and `5 min readuseState. It also assumes you know how to pass an event handler such as onClick, and that you are comfortable with arrow functions and destructuring. The previous chapters covered events and state. This c6 min readvalue plus onChange), how useState returns a value and a setter, and how object spread and computed property names work in JavaScript. If any of these are unfamiliar, review them first.5 min readvalue plus onChange) and keep several fields in one state object, as covered in the previous chapters. It also assumes you are comfortable with spread syntax and computed property names.4 min readuseState and know how React attaches event handlers such as onChange. It also assumes you are comfortable with async/await and fetch. Here you will learn how a form submission works in the browser, how React lets you intercept it, 5 min readuseState, event handlers, and the controlled input pattern from the earlier chapters. You should also be comfortable with destructuring and arrow functions.5 min readuseState, how onSubmit and preventDefault work, and how to read e.target in an event handler. Here you will read a form's values in one step at submit time, without keeping every keystroke in React state.4 min readuseState, share one change handler across several fields, and write an onSubmit handler that calls preventDefault. Here you will turn the values in state into error messages, decide when to check them, and avoid the usual mistakes. How 5 min readuseState, you know how a controlled input works, and you have a pure validate(values) function that returns an errors object, as in the previous chapter. Here you decide when those errors appear on screen.5 min readuseState, write a validate function that returns an errors object, and handle onSubmit with preventDefault. It adds the accessibility layer: every field needs a programmatic label, and every error needs a programmatic link to the fiel7 min readuseState, controlled inputs, a single state object for many fields, and onSubmit with preventDefault. It covers how a form gets its starting values, how to return it to those values, and how to load different records into the same form without stale data.5 min readuseState, event handlers, and FormData from the earlier chapters. It covers why <input type="file"> is the one form control React cannot control, and how to work with it anyway.5 min readuseState, controlled inputs (value plus onChange), and basic props. It explains why a controlled input re-renders its component on every keystroke, when that matters, and which fixes to try first.5 min readuseState, controlled and uncontrolled inputs, FormData, onSubmit with preventDefault, and the validation and accessibility patterns from earlier chapters.6 min read