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 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>
|
||||
|
||||
Reference in New Issue
Block a user