Skip to content

Commit

Permalink
Include import statement in original example
Browse files Browse the repository at this point in the history
  • Loading branch information
snapwich committed Jul 16, 2019
1 parent a9c0fd0 commit 79369f2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions readme.md
Expand Up @@ -481,6 +481,8 @@ Code style is highly personal, but for code bases that are to be understood by m
Immer 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.

```js
import {original} from "immer"

const baseState = {users: [{name: "Richie"}]}
const nextState = produce(baseState, draftState => {
original(draftState.users) // is === baseState.users
Expand Down

0 comments on commit 79369f2

Please sign in to comment.