Skip to content
Myr

Merge pull request #397 from snapwich/patch-1

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Include import statement in `original` example

authored by Michel Weststrate · committed by GitHub · parents d51ac21, 79369f2 · Browse files · 1 file+2 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−0 removed

  • other:+2 added−0 removed

1 file+2 added−0 removed

modified:readme.md+2 added
479 unmodified lines
480481Immer exposes a named export `original` that will get the original object from the proxied instance inside `produce` (or return `undefined` for unproxied values). A good example of when this can be useful is when searching for nodes in a tree-like state using strict equality.482483```js484import {original} from "immer"485486const baseState = {users: [{name: "Richie"}]}487const nextState = produce(baseState, draftState => {488 original(draftState.users) // is === baseState.users489})
303 unmodified lines