# preact-robot

> Preact hooks for Robot finite state machines

Latest version **1.1.0** (published 2025-01-14) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install preact-robot
pnpm add preact-robot
yarn add preact-robot
bun add preact-robot
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2025-01-14 |
| First published | 2019-09-15 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Matthew Phillips |
| Maintainers | matthewp |
| Keywords | Preact, Finite state machine |

## Links

- npm: https://www.npmjs.com/package/preact-robot
- Repository: https://github.com/matthewp/preact-robot
- Homepage: https://github.com/matthewp/preact-robot#readme
- Issues: https://github.com/matthewp/preact-robot/issues
- npm.io page: https://npm.io/package/preact-robot

## Dependencies (2)

- [rollup](https://npm.io/package/rollup.md) ^2.8.2
- [robot-hooks](https://npm.io/package/robot-hooks.md) ^1.1.0

## Recent versions

- 1.1.0 (latest) — 2025-01-14
- 1.0.0 — 2024-11-10
- 0.3.0 — 2023-02-02
- 0.2.3 — 2020-05-08
- 0.2.2 — 2020-05-07
- 0.2.1 — 2019-09-24
- 0.2.0 — 2019-09-19
- 0.1.0 — 2019-09-15

## README

# preact-robot

[Preact](https://preactjs.com/) hooks for use with [Robot](https://thisrobot.life/).

See documentation on [the website](https://thisrobot.life/integrations/preact-robot.html).

```js
import { useMachine } from 'preact-robot';
import { h } from 'preact';
import { html } from 'htm/prect';
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](https://thisrobot.life/integrations/preact-robot.html)

* Please star [the repository](https://github.com/matthewp/preact-robot) on GitHub.
* [File an issue](https://github.com/matthewp/preact-robot/issues) if you find a bug. Or better yet...
* [Submit a pull request](https://github.com/matthewp/preact-robot/compare) to contribute.

## License

BSD-2-Clause

---
_Source: https://npm.io/package/preact-robot · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
