react-robot

0.3.0 • Public • Published

react-robot

React hooks for use with Robot finite state machines.

See documentation on the website.

import { useMachine } from 'react-robot';
import React from 'react';
import { createMachine, state, transition } from 'robot3';

const machine = createMachine({
  one: state(
    transition('next', 'two')
  ),
  two: state()
});

function App() {
  const [current, send] = useMachine(machine);
  
  return html`
    <button type="button" onClick=${() => send('next')}>
      State: ${current.name}
    </button>
  `;
}

📚 Documentation

License

BSD-2-Clause

/react-robot/

    Package Sidebar

    Install

    npm i react-robot

    Weekly Downloads

    3,446

    Version

    0.3.0

    License

    BSD-2-Clause

    Unpacked Size

    2.64 kB

    Total Files

    4

    Last publish

    Collaborators

    • matthewp