What is a controlled form in React?

React routing and forms · Freshers

Model answer

The input value comes from state and an onChange handler updates the state: <input value={name} onChange={(e) => setName(e.target.value)} />. React is the single source of truth, so you can validate while typing or disable a button until the form is valid.

On submit, call e.preventDefault() and use the state.

Learn this topic

React Router: Multiple Pages, Links, Params, Layouts and Protected Routes in the course React.js Full Course: Beginner to Advanced.

Sign in to add your own answer.

More questions