refactor(steps): simplify step presenters by removing unnecessary useImperativeHandle calls

- Removed useImperativeHandle and getValues from BenefitsStep, ChallengesStep, ChartStep, ContactsStep, FeaturesStep, FooterStep, and HeroStep components.
- Updated step presenters to directly use refs for improved data handling and validation.
- Enhanced code readability and maintainability by streamlining the presenter functions.
This commit is contained in:
AmirReza Jamali
2026-04-18 12:41:48 +03:30
parent c1b6b4ccf1
commit 69e75eb9b8
16 changed files with 364 additions and 272 deletions
@@ -1,5 +1,5 @@
"use client";
import { forwardRef, useImperativeHandle } from "react";
import { forwardRef } from "react";
import SectionStep from "./SectionStep";
import useFeaturesStepPresenter, {
IFeaturesStepFields,
@@ -20,12 +20,7 @@ const FeaturesStep = forwardRef<unknown, FeaturesStepProps>(
append,
remove,
control,
getValues,
} = useFeaturesStepPresenter(initialData);
useImperativeHandle(ref, () => ({
getData: () => getValues(),
}));
} = useFeaturesStepPresenter(initialData, ref);
return (
<SectionStep<IFeaturesStepFields>