Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Using multiple useStep's #41

Open
IlirBajrami opened this issue May 13, 2022 · 0 comments
Open

Using multiple useStep's #41

IlirBajrami opened this issue May 13, 2022 · 0 comments

Comments

@IlirBajrami
Copy link

IlirBajrami commented May 13, 2022

I'm trying to use two useStep hooks in one function.
I tried this:

const steps = [
  { id: "name", Component: NameField },
  { id: "email", Component: EmailField },
  { id: "phoneNumber", Component: PhoneNumberField },
  { id: "message", Component: MessageField },
  { id: "review", Component: ReviewForm },
  { id: "confirmation", Component: ConfirmationForm },
];
const steps2 = [
  { id: "website", Component: WebsiteField },
  { id: "services", Component: ServicesField },
  { id: "overview", Component: OverviewField },
  { id: "budget", Component: BudgetField },
  { id: "reviewComplete", Component: ReviewCompleteForm },
];
const MultiStepForm = () => {

  const [formData, setForm] = useForm(defaultData);
  const { step, navigation, index } = useStep({ initialStep: 0, steps });
  const { step: quoteStep, navigation: quoteNavigation, index: quoteIndex } = useStep({ initialStep: 0, steps: steps2 });

}

but i get this Error:

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Can we use multiple useStep hooks in the same function?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant