Take the following finite-state machine:
const machine = Machine({
initial: "foo",
states: {
foo: {
on: {
BAZ: "baz",
QUX: "qux",
},
},
bar: {
on: {
BAZ: "baz",
QUX: "qux",
},
},
baz: {
on: {
FOO: "foo",
BAR: "bar",
},
},
qux: {
on: {
FOO: "foo",
BAR: "bar",
},
},
},
});
Notice that there are two duplicated sets of state transitions:
on: {
FOO: "foo",
bar: "bar",
}
on: {
BAZ: "baz",
QUX: "qux",
}
Other than defining the state transitions as good ol' JavaScript objects outside of the Machine definition, is there an idiosyncratic way to do this?