Skip to content

Commit

Permalink
Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano committed Apr 29, 2021
1 parent 8c91497 commit 4f2f626
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .changeset/cyan-dolphins-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
'xstate': minor
---

Tags can now be added to state node configs under the `.tags` property:

```js
const machine = createMachine({
initial: 'green',
states: {
green: {
tags: 'go' // single tag
},
yellow: {
tags: 'go'
},
red: {
tags: ['stop', 'other'] // multiple tags
}
}
});
```

You can query whether a state has a tag via `state.hasTag(tag)`:

```js
const canGo = state.hasTag('go');
// => `true` if in 'green' or 'red' state
```

0 comments on commit 4f2f626

Please sign in to comment.