Skip to content

Collaborne/react-robot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>
  `;
}

License

BSD-2-Clause

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 62.1%
  • HTML 37.9%