Files
web/packages/sdk-react
dependabot[bot] e6d25f2fd1 chore(deps): bump better-result from 1.0.1 to 2.9.2 (#1150)
Bumps [better-result](https://github.com/dmmulroy/better-result) from 1.0.1 to 2.9.2.
- [Release notes](https://github.com/dmmulroy/better-result/releases)
- [Commits](https://github.com/dmmulroy/better-result/compare/v1.0.1...v2.9.2)

---
updated-dependencies:
- dependency-name: better-result
  dependency-version: 2.9.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-16 14:21:43 -04:00
..

@meshtastic/sdk-react

React hooks and provider for @meshtastic/sdk.

Install

pnpm add @meshtastic/sdk @meshtastic/sdk-react @meshtastic/transport-web-serial

Quickstart

import { MeshClient } from "@meshtastic/sdk";
import { MeshProvider, useDevice, useChat } from "@meshtastic/sdk-react";
import { TransportWebSerial } from "@meshtastic/transport-web-serial";
import { ChannelNumber } from "@meshtastic/sdk";

const transport = await TransportWebSerial.create({ baudRate: 115200 });
const client = new MeshClient({ transport });
await client.connect();

function App() {
  return (
    <MeshProvider client={client}>
      <Status />
    </MeshProvider>
  );
}

function Status() {
  const { status, myNodeNum } = useDevice();
  const { messages, send } = useChat(ChannelNumber.Primary);
  return <div>{status} / {myNodeNum} / {messages.length} msgs</div>;
}

All hooks are read-only against a single MeshClient instance supplied through context. Commands are returned as stable functions.

License

GPL-3.0-only.