react-use-wizard
react-use-wizard copied to clipboard
feat: check handle step.
Make it possible to interrupt the handleStep to navigate to next step.
Hi, thank you very much for this PR.
As far as I can see this functionality is already baked in, however by using try/catch, see https://github.com/devrnt/react-use-wizard/blob/main/src/wizard.tsx#L57-L66. Also, see the test cases here.
Feel free to reply if you have any comments or questions
Is there a release date also for this by chance? Thanks
Are there any plans to support such functionality? @devrnt
Edit: I feel like that this need encapsulates two problems:
- Throwing error within handler just for the sake of stopping nextStep() feels counter intuitive.
- Actual handling of such error that has been thrown from handleStep() is not documented at all. Yes, it is easy to make the connection between handleStep() and nextStep(), however, it would help a lot if it were to be documented.
- Throwing error within handler just for the sake of stopping nextStep() feels counter intuitive.
Indeed, this feels a bit off at the moment
- Actual handling of such error that has been thrown from handleStep() is not documented at all. Yes, it is easy to make the connection between handleStep() and nextStep(), however, it would help a lot if it were to be documented.
You're right, there is only one mention in the docs at the moment, are you willing to pick this up?
You're right, there is only one mention in the docs at the moment, are you willing to pick this up?
I am willing to pick this up.
I am also looking at this feature.
I've noticed this pr only after leaving the following comment (which is weirdly not linked): https://github.com/devrnt/react-use-wizard/issues/74#issuecomment-1731210574
I gotta say that throwing is perfectly fine, it just needs a mention on the docs but I feel like creating a new paragraph about that wasn't super effective. It should be mentioned in the props table: https://github.com/devrnt/react-use-wizard#props
Furthermore, please @devrnt close this pr and the issue attached since it's been managed somehow
Closing because already possible with the current API