React · Forms

Forms Interview Questions
With Answers & Code Examples

1 carefully curated Forms interview questions with working code examples and real interview gotchas.

Practice Interactively →← All Categories
1 questions0 beginner1 core0 advanced
Q1Core

What is react-hook-form and why is it better than manual controlled forms?

💡 Hint: Uncontrolled inputs with ref-based validation — zero re-renders per keystroke, minimal boilerplate

Manual controlled forms re-render on every keystroke for every field. react-hook-form uses uncontrolled inputs and only triggers re-renders on validation state changes.

import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';

const schema = z.object({
  email: z.string().email('Invalid email'),
  password: z.string().min(8, 'Min 8 characters'),
});

function LoginForm() {
  const {
    register,
    handleSubmit,
    formState: { errors, isSubmitting }
  } = useForm({ resolver: zodResolver(schema) });

  const onSubmit = async (data) => {
    await api.login(data); // data is fully typed and validated
  };

  return (
    
{errors.email &&

{errors.email.message}

} {errors.password &&

{errors.password.message}

}
); }

Why it's better:

  • Zero re-renders while typing (uncontrolled under the hood)
  • Schema-based validation with Zod/Yup integration
  • Tiny bundle (9kb), no dependencies
  • Works with any UI library (MUI, Chakra, Radix)
💡 react-hook-form's register() returns { name, ref, onChange, onBlur }. The ref tracks the DOM input value. React never "knows" about each keystroke — validation only fires on blur/submit.
Practice this question →

Other React Interview Topics

Rendering StrategiesCore JSType SystemReact FundamentalsFunctionsMicrofrontendsGenericsAsync JSHooksObjectsMonorepoArrays'this' KeywordUtility TypesError HandlingModern JSBundle OptimizationPerformanceDOM & EventsState ManagementClasses & OOPCaching StrategiesComponent PatternsAdvanced TypesAuthenticationReact RouterAdvanced PatternsFrontend SecurityConcurrent ReactServer ComponentsTestingEcosystemNetwork OptimizationCore Web VitalsBrowser APIs

Ready to practice Forms?

Get AI feedback on your answers, predict code output, and fix real bugs.

Start Free Practice →