worked on GarageApp stuff
This commit is contained in:
parent
60aaf17af3
commit
eb606572b0
51919 changed files with 2168177 additions and 18 deletions
35
node_modules/@emotion/weak-memoize/README.md
generated
vendored
Normal file
35
node_modules/@emotion/weak-memoize/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# @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
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue