@coaction/xstate
v1.5.0
Published
A Coaction integration tool for XState
Readme
@coaction/xstate
A Coaction integration tool for XState.
Installation
You can install it via npm, yarn or pnpm.
npm install coaction @coaction/xstate xstateUsage
import { create } from 'coaction';
import {
adapt,
assign,
bindXState,
createActor,
createMachine
} from '@coaction/xstate';
const machine = createMachine({
context: {
count: 0
},
on: {
increment: {
actions: assign({
count: ({ context }) => context.count + 1
})
}
}
});
const actor = createActor(machine);
actor.start();
const store = create(() => adapt(bindXState(actor)));
store.getState().send({ type: 'increment' });Limitations
@coaction/xstateonly supports binding a whole XState actor.- Coaction
Slicesmode is not supported in this adapter. setState()is blocked; update state through actor events.
Documentation
You can find the documentation here.
