Course contentsShow
← React
Lesson 510 of 2,39614. Uncontrolled ComponentsFree lesson

Performance-Sensitive Large Forms

Uncontrolled inputs avoid re-renders on every keystroke, making them suitable for very large forms where performance matters.

Performance-Sensitive Large Forms

What you'll learn: Why uncontrolled components are ideal for large forms where re-render performance becomes a real concern.

The Problem with Large Controlled Forms

Imagine a form with 50+ input fields—medical records, financial applications, detailed surveys. If every field is controlled (using value and onChange), every single keystroke in any field triggers a re-render of the entire form component. Type one word across 5 fields? That's potentially 20+ re-renders cascading through your component tree.

For small forms, this is barely noticeable. For large forms, especially on slower devices or with complex parent components, users might experience lag between keystrokes.

Why Uncontrolled Components Solve This

Uncontrolled inputs using refs live entirely in the DOM. When a user types, React doesn't know about it—no state update, no re-render, no reconciliation. The browser handles the typing natively, which is always fast.

You only interact with React when you actually need the values, typically on form submission:

function LargeForm() {
  const field1Ref = useRef(null);
  const field2Ref = useRef(null);
  // ... 48 more refs

  function handleSubmit(e) {
    e.preventDefault();
    const data = {
      field1: field1Ref.current.value,
      field2: field2Ref.current.value,
      // ... gather all values
    };
    // Process once, not 500 times during typing
  }

  return (
    <form onSubmit={handleSubmit}>
      <input ref={field1Ref} defaultValue="" />
      <input ref={field2Ref} defaultValue="" />
      {/* ... 48 more inputs */}
    </form>
  );
}

The Trade-Off

You sacrifice real-time validation and dynamic UI updates, but gain silky-smooth typing performance. For data entry forms where validation happens on submit anyway, this trade-off makes perfect sense.

Key Takeaway: Uncontrolled components bypass React's render cycle entirely during user input, making them the performance-optimal choice for large forms where hundreds of keystrokes shouldn't trigger hundreds of re-renders.