devrnt / react-use-wizard

🧙 A React wizard (stepper) builder without the hassle, powered by hooks.

Home Page:https://devrnt.github.io/react-use-wizard/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gotToStep() fails with dynamically rendered step

nathanlepori opened this issue · comments

See repro:
https://codesandbox.io/embed/clever-cloud-tigmwb?fontsize=14&hidenavigation=1&theme=dark

After clicking "Add step" it's not possible to navigate to step "four". Step count is not correctly set inside goToStep().
nextStep() and previousStep() work fine.

This is indeed an issue, thanks for reporting.

The issue is that https://github.com/devrnt/react-use-wizard/blob/main/src/wizard.tsx#L32-L47 is stale and won't update if the stepCount changes