# hyperapp-deepupdate

> hyperapp mixin for deep state update

Latest version **0.0.2** (published 2017-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install hyperapp-deepupdate
pnpm add hyperapp-deepupdate
yarn add hyperapp-deepupdate
bun add hyperapp-deepupdate
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-08-19 |
| First published | 2017-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Lafole Ludovic |
| Maintainers | ludoviclafole |
| Keywords | hyperapp, mixin, deepupdate |

## Links

- npm: https://www.npmjs.com/package/hyperapp-deepupdate
- Repository: https://github.com/nooblad/hyperapp-deepupdate
- Homepage: https://github.com/nooblad/hyperapp-deepupdate#readme
- Issues: https://github.com/nooblad/hyperapp-deepupdate/issues
- npm.io page: https://npm.io/package/hyperapp-deepupdate

## Recent versions

- 0.0.2 (latest) — 2017-08-19
- 0.0.1 — 2017-08-19

## README

# Hyperapp DeepUpdate


## Usage
install :
```bash
npm install --save hyperapp-deepupdate
```

A basic complete example
```jsx harmony
import { app, h } from 'hyperapp'
import { deepUpdateMixin } from 'hyperapp-deepupdate'

app({
    state  : {
        counters: [
            {
                value: 0,
            },
            {
                value: 2,
            },
        ],
    },
    view(state, actions) {
        return <div>
            <ul>
                {
                    state.counters.map((counter, i) => <div>
                        <p>{counter.value}</p>
                        <button type="button" onclick={() => actions.increment(i)}>Add</button>
                    </div>)
                }
            </ul>
        </div>
    },
    actions: {
        increment(state, actions, index) {
            return [ 'counters', index, 'value', state => state + 1 ]
        }
    },
    mixins : [ deepUpdateMixin ]
})
```

Using with thunk :
```js
    actions: {
        increment(state, actions, index) {
            return update => update([ 'counters', index, 'value', state => state + 1 ])
        }
    },
```

Batching updates :
```js
    actions: {
        increment(state, actions, index) {
            return [
              [ 'counters', index, 'value', state => state + 1 ],
              [ 'counters', index, 'value', state => state + 1 ],
          ]
        }
    },
```

---
_Source: https://npm.io/package/hyperapp-deepupdate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
