# @hon2a/use-object-memo

> Memoizes object data, providing a reference that gets updated only when the data changes.

Latest version **1.1.0** (published 2021-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hon2a/use-object-memo
pnpm add @hon2a/use-object-memo
yarn add @hon2a/use-object-memo
bun add @hon2a/use-object-memo
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-04-13 |
| First published | 2019-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jan Konopásek |
| Maintainers | hon2a |

## Links

- npm: https://www.npmjs.com/package/@hon2a/use-object-memo
- Repository: https://github.com/hon2a/use-object-memo
- Homepage: https://github.com/hon2a/use-object-memo#readme
- Issues: https://github.com/hon2a/use-object-memo/issues
- npm.io page: https://npm.io/package/@hon2a/use-object-memo

## Dependencies (3)

- [core-js](https://npm.io/package/core-js.md) ^3.4.5
- [lodash.isequal](https://npm.io/package/lodash.isequal.md) ^4.5.0
- [@babel/runtime-corejs3](https://npm.io/package/@babel/runtime-corejs3.md) ^7.7.4

## Recent versions

- 1.1.0 (latest) — 2021-04-13
- 1.0.0 — 2019-12-01

## README

# use-object-memo

Memoizes object data, providing a reference that gets updated only when the data changes.

## Use

Memoize object data to use e.g. as dependencies in subsequent `useEffect` calls.
This is useful e.g. in hooks that accept options as object.

```javascript
import { useEffect } from 'react'
import { useObjectMemo } from '@hon2a/use-object-memo'

export function useThisCoolHook(options) {
  const optionsMemo = useObjectMemo(options)
  useEffect(() => {
    // … perform some effect that should really only be performed when the options change
  }, [optionsMemo])
} 
```

## Development

### Install

Install dependencies using:

```sh
npm install
```

### Develop

After you modify sources, run the following (or set up your IDE to do it for you):

- format the code using `npm run format`
- lint it using `npm run lint`
- test it using `npm test`

and fix the errors, if there are any.

### Publish

Publishing is done in two steps:

1. Create a new version tag and push it to the repository:
    ```sh
    npm version <patch|minor|major>
    git push --follow-tags
    ```
1. Build and publish the new version as a npm package:
    ```sh
    npm publish --access public
    ```

---
_Source: https://npm.io/package/@hon2a/use-object-memo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
