An open API service indexing awesome lists of open source software.

https://github.com/codefeathers/react-use-set

Set in React Hooks
https://github.com/codefeathers/react-use-set

hooks react set usestate

Last synced: 18 days ago
JSON representation

Set in React Hooks

Awesome Lists containing this project

README

          

# use-set

Use a Set in your React Hooks.

## Installation

```bash
npm i use-set
```

## Usage

```JavaScript
import { useSet } from "use-set";

const List = (props) => {
const checked = useSet(new Set());

const toggle = key =>
checked.has(key)
? checked.delete(key)
: checked.add(key);

return


{props.list.map(item =>
toggle(item.key)}
/>}
;

};
```