# 与 RxJS 一起使用
The interpreted machine (i.e., service
) is subscribable.
import { createMachine, interpret } from 'xstate';
import { from } from 'rxjs';
const machine = createMachine(/* ... */);
const service = interpret(machine).start();
const state$ = from(service);
state$.subscribe((state) => {
// ...
});