# use-bsv-wasm

> Hook for using bsv-wasm in react components.

Latest version **0.0.5** (published 2023-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-bsv-wasm
pnpm add use-bsv-wasm
yarn add use-bsv-wasm
bun add use-bsv-wasm
```

## Health

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

Positive: has types; no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-07-30 |
| First published | 2023-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Luke Rohenaz |
| Maintainers | wildsatchmo |

## Links

- npm: https://www.npmjs.com/package/use-bsv-wasm
- Repository: https://github.com/rohenaz/use-bsv-wasm
- Homepage: https://github.com/rohenaz/use-bsv-wasm#readme
- Issues: https://github.com/rohenaz/use-bsv-wasm/issues
- npm.io page: https://npm.io/package/use-bsv-wasm

## Dependencies (1)

- [bsv-wasm-web](https://npm.io/package/bsv-wasm-web.md) ^2.0.1

## Recent versions

- 0.0.5 (latest) — 2023-07-30
- 0.0.4 — 2023-07-30
- 0.0.3 — 2023-07-30
- 0.0.2 — 2023-07-30
- 0.0.1 — 2023-07-30

## README

# use-bsv-wasm

Hook for using bsv-wasm in react apps.

## Usage

Import the `useBsvWasm` hook

```ts
import { useBsvWasm } from "use-bsv-wasm";
```

Add to your AppContext:

```ts
import React, { ReactNode } from "react";
import { BsvWasmProvider } from "use-bsv-wasm";

interface Props {
  children: ReactNode;
}

const AppContext: React.FC<Props> = ({ children }) => {
  return <BsvWasmProvider>{children}</BsvWasmProvider>;
};

export default AppContext;
```

Use in your component.

```ts
import { useBsvWasm } from "use-bsv-wasm";

const { initialized } = useBsvWasm();

useEffect(() => {
  if (initialialized) {
    // Doesn't throw an error
    const address = P2PKHAddress.from_string(
      "1FVYXV4QnBv6XxqJZVjTb5HhXZV3z2kqjy"
    );
  }
}, [initialialized]);
```

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