How to use the xstate.createMachine function in xstate

To help you get started, we’ve selected a few xstate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidkpiano / xstate / packages / xstate-viz / example / index.tsx View on Github external
import 'react-app-polyfill/ie11';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { MachineViz, ServiceViz } from '../src/index';
import { createMachine, interpret } from 'xstate';

const machine = createMachine({
  initial: 'off',
  states: {
    off: {
      after: {
        5000: 'on',
      },
    },
    on: {},
  },
});

const service = interpret(machine).start();

const App = () => {
  return (
    <div></div>