← React Intermediate Questions - Set 1 Q2

How do you manage forms with multiple inputs in React?

React Intermediate Questions - Set 1

Example

const [form, setForm] = useState({ name: '', email: '' });
const onChange = e => setForm(f => ({ ...f, [e.target.name]: e.target.value }));
// <input name="name" value={form.name} onChange={onChange} />

What to notice

← Back to the question list