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

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

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