(
nextState: FormState<T> | ((prev: FormState<T>) => FormState<T>),
)
| 56 | const fieldArrayKeyCounterRef = ctx.useRef<number>(0); |
| 57 | |
| 58 | const updateFormState = ( |
| 59 | nextState: FormState<T> | ((prev: FormState<T>) => FormState<T>), |
| 60 | ): void => { |
| 61 | setState((prev) => { |
| 62 | const resolved = |
| 63 | typeof nextState === "function" |
| 64 | ? (nextState as (prev: FormState<T>) => FormState<T>)(prev) |
| 65 | : nextState; |
| 66 | stateRef.current = resolved; |
| 67 | return resolved; |
| 68 | }); |
| 69 | }; |
| 70 | |
| 71 | const wizardSteps = options.wizard?.steps ?? []; |
| 72 | const stepCount = wizardSteps.length; |