https://github.com/filipdanic/use-array
A custom React hook that lets you manipulate an array data structure without ever needing extra utilities.
https://github.com/filipdanic/use-array
hooks hooks-api-react react react-hooks reactjs
Last synced: 12 months ago
JSON representation
A custom React hook that lets you manipulate an array data structure without ever needing extra utilities.
- Host: GitHub
- URL: https://github.com/filipdanic/use-array
- Owner: filipdanic
- License: mit
- Created: 2019-05-15T21:51:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-15T22:14:41.000Z (almost 7 years ago)
- Last Synced: 2024-10-11T07:56:02.133Z (over 1 year ago)
- Topics: hooks, hooks-api-react, react, react-hooks, reactjs
- Language: JavaScript
- Homepage: https://filipdanic.github.io/use-array
- Size: 596 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/use-array)
# use-array
A custom React hook that lets you manipulate an array data structure without ever needing extra utilities.
[👉 Demo site and docs.](https://filipdanic.github.io/use-array/)
Start with:
```bash
npm install --save use-array
```
Then, import and use the hook:
```javascript
import useArray from 'use-array'
// …in your functional component:
const [ list, {
set, empty, replace, push,
updateAt, setAt, removeAt,
filter, map, sort, reverse,
mergeBefore, mergeAfter,
}] = useArray(defaultList);
```
## Docs
The complete documentation as well as a live demo [is available here.](https://filipdanic.github.io/use-array/)
## License
MIT © [filipdanic](https://github.com/filipdanic)