# 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: 5/16/2022, 12:12:35 PM