# react-webserial-hook

> A React Hook for WebSerial API

Latest version **0.0.1** (published 2023-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-webserial-hook
pnpm add react-webserial-hook
yarn add react-webserial-hook
bun add react-webserial-hook
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-12-10 |
| First published | 2023-12-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Mniota Team |
| Maintainers | arag0re |

## Links

- npm: https://www.npmjs.com/package/react-webserial-hook
- Repository: https://github.com/mniota/react-webserial-hook
- Homepage: https://github.com/mniota/react-webserial-hook#readme
- Issues: https://github.com/mniota/react-webserial-hook/issues
- npm.io page: https://npm.io/package/react-webserial-hook

## Recent versions

- 0.0.1 (latest) — 2023-12-10

## README

# @mniota/react-webserial-hook

> A React Hook for WebSerial API

## Install

```
npm i @mniota/react-webserial-hook
```

## Usage

For more options, check the API autocomplete in your IDE:

```js
import { useWebSerial } from "@mniota/react-webserial-hook"

function Component() {
  const serial = useWebSerial({
    onData: data => {
      const decored = new TextDecoder();
      console.log(decoder.decode(data));
    }
  })

  return (
    <div>
      <button onClick={() => serial.requestPort()}>
        Pair a new port
      </button>
      <button onClick={() => serial.openPort()}>
        Open the selected port
      </button>
      <button onClick={() => serial.startReading()}>
        Start reading
      </button>
    <div>
    )
}
```

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