Form Libraries' Approach: Uncontrolled with Smart Subscriptions
What you'll learn: How modern form libraries like React Hook Form achieve excellent performance by combining uncontrolled inputs with selective re-rendering.
The Best of Both Worlds
You've learned that controlled forms cause re-renders on every keystroke, while uncontrolled forms avoid this but sacrifice reactivity. Libraries like React Hook Form found a clever middle ground: let the DOM hold the data (uncontrolled), but provide a subscription system for components that actually need to react to changes.
Think of it like a newspaper subscription service. The newspaper (form data) gets published daily, but you only receive copies if you've explicitly subscribed. Your neighbor doesn't get your paper just because they live nearby — they need their own subscription.
How It Works
React Hook Form uses ref to access uncontrolled inputs directly from the DOM. Your component doesn't re-render as users type. However, if you need to display an error message or show character count, you can subscribe to specific field changes. Only the components watching that field re-render — not your entire form.
The library tracks which parts of your UI depend on which form fields. When you call methods like watch('email'), you're telling the library: "I care about this field specifically." Now only that watching component re-renders when email changes, not unrelated fields.
The Performance Win
With 20 form fields, typing in one field doesn't trigger 20 component updates. The input updates itself (DOM-managed), and only explicitly subscribed UI elements re-render. It's the controlled form's reactivity without the performance penalty.
Key Takeaway: Modern form libraries achieve optimal performance by keeping inputs uncontrolled (DOM-managed) while offering fine-grained subscription APIs that let specific components opt into re-rendering only when their watched values change.