Skip to content

Instantly share code, notes, and snippets.

@surfer19
Created September 27, 2020 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surfer19/6acc1b4734f7c2031742d89fdcbee948 to your computer and use it in GitHub Desktop.
Save surfer19/6acc1b4734f7c2031742d89fdcbee948 to your computer and use it in GitHub Desktop.
// RegistrationFormStepper.jsx
import React from "react";
import { useStep } from "react-hooks-helper";
import { Step1 } from "./views/Step1";
import { Step2 } from "./views/Step2";
const steps = [{ id: "step1" }, { id: "step2" }];
export const RegistrationFormStepper = () => {
const { step, navigation } = useStep({ initialStep: 0, steps });
const props = { navigation };
const { id } = step;
switch (id) {
case "step1":
return <Step1 {...props} />;
case "step2":
return <Step2 {...props} />;
default:
return <> Error! </>;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment