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
- Host: GitHub
- URL: https://github.com/codefeathers/react-use-set
- Owner: codefeathers
- Created: 2020-01-22T12:05:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-23T12:17:45.000Z (over 6 years ago)
- Last Synced: 2025-08-17T19:41:20.328Z (9 months ago)
- Topics: hooks, react, set, usestate
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)}
/>}
;
};
```