# Usage with RxJS

These XState v4 docs are no longer maintained

XState v5 is out now! Read more about XState v5 (opens new window) and check out the XState v5 docs (opens new window).

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) => {
  // ...
});