- {Array.from({ length: totalSteps }).map((_, index) => {
- const renderStepProps = {
- index,
- currentStep,
- totalSteps,
- isFirst: index === 0,
- isLast: index === totalSteps - 1,
- nextStep,
- previousStep,
- goToStep,
- isCompleted: index < currentStep,
- isCurrent: index === currentStep,
- isDisabled: index > currentStep,
- } satisfies RenderStepProps
+ {renderStep == null ? null : (
+
+ {Array.from({ length: totalSteps }).map((_, index) => {
+ const renderStepProps = {
+ index,
+ currentStep,
+ totalSteps,
+ isFirst: index === 0,
+ isLast: index === totalSteps - 1,
+ nextStep,
+ previousStep,
+ goToStep,
+ isCompleted: index < currentStep,
+ isCurrent: index === currentStep,
+ isDisabled: index > currentStep,
+ } satisfies RenderStepProps
- return (
-
- {renderStep(renderStepProps)}
-
- )
- })}
-
+ const nextRenderStep = renderStep(renderStepProps)
+
+ if (nextRenderStep == null) {
+ return null
+ }
+
+ return (
+
+ {nextRenderStep}
+
+ )
+ })}
+
+ )}