Is it incorrect to re-use guards by parametizing them? #4919
-
I'm new to xstate and refactoring an existing machine. For simplicity, I've got something like this:
I haven't actually ran it as there are some other refactors in place; but the VSCode plugin is properly able to draw the diagram, so I'm assuming it runs. The problem is, the VSCode plugin is showing a few orange question marks that say: I would appreciate some pointers, am I doing it wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Which version of XState are you using? It looks like you're using v4. This might be a problem with the extension. But yes, in v5, you can use parameters and it's actually encouraged. See here: https://stately.ai/docs/guards#guard-object |
Beta Was this translation helpful? Give feedback.
You can use parameterized guards in v4 as well. If you see any warning/error, that's probably a problem with the extension.