Skip to content
Myr

Include import statement in `original` example

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

authored by Rich Snapp · committed by GitHub · parent a9c0fd0 · 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