0PricingLogin
React Native Academy · Lesson

Multi-Step Forms with Form State

Split a long registration form into multiple steps using a step counter in state, validate only the current step's fields before advancing to the next.

What Is a Multi-Step Form?

A multi-step form breaks a long registration or checkout flow into discrete, manageable steps — typically 2 to 5 screens. Each step focuses on a related group of fields, reducing cognitive load and improving completion rates compared to a single long scroll. Common examples include onboarding wizards, address-plus-payment checkout flows, and multi-stage profile setup.

Sharing One Form Instance Across Steps

The key to a multi-step form with react-hook-form is to create one useForm instance for the entire form and pass control and errors down as props to each step component. This keeps all field values and validation state in one place. Values entered on step 1 remain available when the user reaches step 3, and submitting the final step accesses the complete form data.

interface RegisterForm {
  name: string;
  email: string;
  password: string;
  phone: string;
  city: string;
}

export default function RegisterScreen() {
  const [step, setStep] = React.useState(1);
  const form = useForm<RegisterForm>({ defaultValues: { name: '', email: '', password: '', phone: '', city: '' } });

  return (
    <View style={styles.container}>
      {step === 1 && <Step1AccountInfo form={form} />}
      {step === 2 && <Step2ContactDetails form={form} />}
      {step === 3 && <Step3Review form={form} onSubmit={handleFinalSubmit} />}
    </View>
  );
}

All lessons in this course

  1. Setting Up react-hook-form with Controller
  2. Validation Rules and Error Messages
  3. Multi-Step Forms with Form State
  4. Submitting and Resetting Forms
← Back to React Native Academy