Buckets:
3.85 GB
70,867 files
Updated 17 days ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| dist | 12 items | ||
| src | 1 items | ||
| LICENSE | 1.09 kB xet | c8828d0a | |
| README.md | 740 Bytes xet | 7a3a77bf | |
| package.json | 861 Bytes xet | 7b419050 |
@emotion/weak-memoize
A memoization function that uses a WeakMap
Install
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.
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
- Total size
- 3.85 GB
- Files
- 70,867
- Last updated
- Nov 3
- Pre-warmed CDN
- US EU US EU