# use-worker-hook

> useWorker

Latest version **1.0.0** (published 2019-02-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-worker-hook
pnpm add use-worker-hook
yarn add use-worker-hook
bun add use-worker-hook
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-02-24 |
| First published | 2019-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | conorhastings |

## Links

- npm: https://www.npmjs.com/package/use-worker-hook
- npm.io page: https://npm.io/package/use-worker-hook

## Dependencies (1)

- [workerize](https://npm.io/package/workerize.md) ^0.1.7

## Recent versions

- 1.0.0 (latest) — 2019-02-24
- 0.0.3 — 2019-02-24

## README

<h1>useWorker</h1>

run a function in a webworker and return the value to your component asynchronously

<h1> usage </h1>

```bash
npm install use-worker-hook
```

```js
import React, { useState, useEffect } from 'react';
import useWorker from 'use-worker-hook';

function add(a, b) {
  return a+b;
}
export default function App({a, b}) {
  const added = useWorker(add, 0, a); // this will run in a webworker
  return <h1>added: {added}</h1>
}
```

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