# Usage with 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) => {
  // ...
});
Last Updated: 10/26/2021, 6:09:54 PM