Package Exports
- react-robot
- react-robot/machine.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-robot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
- Please star the repository on GitHub.
- File an issue if you find a bug. Or better yet...
- Submit a pull request to contribute.
License
BSD-2-Clause