From 92de7ddda50643fab61ed4b2f2dd8d8977dc4334 Mon Sep 17 00:00:00 2001 From: Marc Veens Date: Sun, 19 Jan 2020 02:33:46 +0100 Subject: [PATCH] Readme update --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index b05bbe7..52b5b5b 100644 --- a/README.md +++ b/README.md @@ -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');