https://github.com/azmenak/use-array-state
Provides a reducer to simplify handling of mutations to array state
https://github.com/azmenak/use-array-state
immutable react react-hooks usereducer
Last synced: 5 months ago
JSON representation
Provides a reducer to simplify handling of mutations to array state
- Host: GitHub
- URL: https://github.com/azmenak/use-array-state
- Owner: azmenak
- Created: 2019-03-19T20:46:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-19T21:41:13.000Z (about 7 years ago)
- Last Synced: 2025-10-21T00:53:01.974Z (8 months ago)
- Topics: immutable, react, react-hooks, usereducer
- Language: TypeScript
- Size: 67.4 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# use-array-state
A simple helper to makes changes to an array without needing to worry about mutating the value
## Install
```
npm install use-array-state
```
## Useage
```ts
import useArrayState from 'use-array-state'
function ArrayComponent () {
const [value, valueActions] = useArrayState()
return (
{valueActions.push('new-value')}}
{JSON.stringify(value, null, 2)}
)
}
```
## Available actions
See `src/index.ts` for the the interface, all methods contain docs in types