Skip to content

Getting Started with use-react-workers

The library is published and distributed via NPM

Before you start, ensure you have the following prerequisites:

Installation

Choose your flavor of package manager and install as normal. A few examples:

Yarn

Terminal window
yarn add use-react-workers

pnpm

Terminal window
pnpm add use-react-workers

npm

Terminal window
npm install use-react-workers

Importing

use-react-workers provides several hooks, functions, and types as named exports. You can import them directly into your files like this:

import { useWorkerFunc } from 'use-react-workers';

With use-react-workers, you can significantly enhance your application’s performance by running heavy tasks in the background, without blocking the UI. It’s a great tool to have in your React toolkit.