[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/2023-06-15 18:19 -  
[DIR]src/2023-06-15 18:19 -  
[DIR]types/2023-06-15 18:19 -  
[   ]LICENSE1985-10-26 08:15 1.1K 
[TXT]README.md1985-10-26 08:15 740 d7c1522 post receive test [كارل مبارك]
[   ]package.json2023-06-15 18:21 1.8K 
# @emotion/weak-memoize

> A memoization function that uses a WeakMap

## Install

```bash
yarn add @emotion/weak-memoize
```

## Usage

Because @emotion/weak-memoize uses a WeakMap the argument must be a non primitive type, e.g. objects, functions, arrays and etc. The function passed to `weakMemoize` must also only accept a single argument.

```jsx
import weakMemoize from '@emotion/weak-memoize'

let doThing = weakMemoize(({ someProperty }) => {
  return { newName: someProperty }
})

let obj = { someProperty: true }

let firstResult = doThing(obj)

let secondResult = doThing(obj)

firstResult === secondResult // true

let newObj = { someProperty: true }

let thirdResult = doThing(newObj)

thirdResult === firstResult // false
```