# @kuzmycz/react-cache

> Cache content and get notified when content changes

Latest version **1.1.6** (published 2021-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kuzmycz/react-cache
pnpm add @kuzmycz/react-cache
yarn add @kuzmycz/react-cache
bun add @kuzmycz/react-cache
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2021-05-31 |
| First published | 2020-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 67.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kuzmycz |
| Maintainers | kuzmycz |

## Links

- npm: https://www.npmjs.com/package/@kuzmycz/react-cache
- Repository: https://github.com/kuzmycz/react-cache
- Homepage: https://github.com/kuzmycz/react-cache#readme
- Issues: https://github.com/kuzmycz/react-cache/issues
- npm.io page: https://npm.io/package/@kuzmycz/react-cache

## Recent versions

- 1.1.6 (latest) — 2021-05-31
- 1.1.5 — 2021-05-31
- 1.1.4 — 2021-05-31
- 1.1.3 — 2021-05-31
- 1.1.1 — 2021-04-10
- 1.1.0 — 2020-04-03
- 1.0.11 — 2020-03-28
- 1.0.10 — 2020-03-25
- 1.0.9 — 2020-03-17
- 1.0.8 — 2020-03-16
- 1.0.7 — 2020-03-16
- 1.0.6 — 2020-03-15
- 1.0.5 — 2020-03-11
- 1.0.4 — 2020-03-10
- 1.0.3 — 2020-03-10
- … 3 more at https://npm.io/package/@kuzmycz/react-cache/versions

## README

# react-cache

> Cache content and get notified when content changes

[![NPM](https://img.shields.io/npm/v/react-cache.svg)](https://www.npmjs.com/package/react-cache) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![gzip size](https://badgen.net/bundlephobia/minzip/@kuzmycz/react-cache)](https://bundlephobia.com/result?p=@kuzmycz/react-cache)

## Install

```bash
npm install --save @kuzmycz/react-cache
```

## Usage

```tsx
import * as React from 'react'

import {Cache} from 'react-cache'

const App = () => {
  return (
    <div>
      <div>Test</div>
      <Cache values={{}}>
        <Address name={'buyer'}/>
      </Cache>
    </div>
  )
};

const Address = ({name}) => {
  const [street, setStreet] = useCacheValue(`${name}.street`)
  const [city, setCity] = useCacheValue(`${name}.city`)
  const [state, setState] = useCacheValue(`${name}.state`)
  const [country, setCountry] = useCacheValue(`${name}.country`)
  const [postcode, setPostcode] = useCacheValue(`${name}.postcode`)

  return (<div>
    <label>
      Street:
      <input type='text' value={street} onChange={(e) => setStreet(e.target.value)} />
    </label>
    <label>
      City:
      <input type='text' value={city} onChange={(e) => setCity(e.target.value)} />
    </label>
    <label>
      State:
      <input type='text' value={state} onChange={(e) => setState(e.target.value)} />
    </label>
    <label>
      Country:
      <input type='text' value={country} onChange={(e) => setCountry(e.target.value)} />
    </label>
    <label>
      Postcode:
      <input type='text' value={postcode} onChange={(e) => setPostcode(e.target.value)} />
    </label>
  </div>)
}
```

## License

MIT © [kuzmycz](https://github.com/kuzmycz)

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