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:
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { forwardRef, useImperativeHandle } from "react";
|
||||
import { forwardRef } from "react";
|
||||
import SectionStep from "./SectionStep";
|
||||
import useChallengesStepPresenter, {
|
||||
IChallengesStepFields,
|
||||
@@ -20,12 +20,7 @@ const ChallengesStep = forwardRef<unknown, ChallengesStepProps>(
|
||||
append,
|
||||
remove,
|
||||
control,
|
||||
getValues,
|
||||
} = useChallengesStepPresenter(initialData);
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
getData: () => getValues(),
|
||||
}));
|
||||
} = useChallengesStepPresenter(initialData, ref);
|
||||
|
||||
return (
|
||||
<SectionStep<IChallengesStepFields>
|
||||
|
||||
Reference in New Issue
Block a user