Skip to content

Commit 39465c3

Browse files
committed
Add documentation for xstate local transitions
1 parent a6b62fb commit 39465c3

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

_glossary/local-transition.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,25 @@ Local transitions are only possible to define _from_ a composite state and _to_
3636

3737
## xstate
3838

39-
Xstate does not yet support local transitions. It can be worked around by creating a single state that wraps all of the child states, and place the local transitions on the substate.
39+
In xstate, an internal transition is described by prefixing the target state with a dot.
4040

4141
```
42-
"ALPHABET": {
43-
onentry: ...
44-
onexit: ...
42+
{
43+
initial: 'A',
44+
onEntry: 'something',
45+
onExit: 'something',
46+
on: {
47+
RESET: '.A'
48+
},
4549
states: {
46-
fake_state: {
47-
initial: A
48-
on: {
49-
RESET: A
50-
}
51-
states: {
52-
A: ...
53-
B: ...
54-
C: ...
55-
}
50+
A: {
51+
on: { SIGNAL: 'B' }
52+
},
53+
B: {
54+
on: { SIGNAL: 'C' }
55+
},
56+
C: {
57+
on: { SIGNAL: 'A' }
5658
}
5759
}
5860
}

0 commit comments

Comments
 (0)