Skip to content

Commit

Permalink
Readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
marcveens committed Jan 19, 2020
1 parent 72210a9 commit 92de7dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ A mutex implementation using React and React context. It will prevent a function

I created this because I wanted to prevent a fetch from running multiple times after implementing a custom hook in multiple components. The custom hook had a `useEffect` which ran the fetch function.

## Install
$ npm install react-context-mutex

## Demo
[![Edit react-context-mutex](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/react-context-mutex-w27h0?expanddevtools=1&fontsize=14&hidenavigation=1&module=%2Fsrc%2FuseFetchHook.ts&theme=dark)

## How to use
```ts
import { useMutex } from 'react-context-mutex';

const fetchData = () => {
const mutex = new Mutex('myUniqueKey1');

Expand Down

0 comments on commit 92de7dd

Please sign in to comment.