Check if a state transition is possible with a hook #2066
VanTanev
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Edit: This is now available as part of https://github.com/VanTanev/xstate-helpers
I wrote a piece of code that I think might be useful to someone, and wanted to share it:
Often times we might have a guarded transition, or only some states respond to a particular event.
This hook allows us to see if sending a given event to a machine will result in a state transition or not.
Used like this:
Beta Was this translation helpful? Give feedback.
All reactions