Skip to content
Myr

docs: Update produce.mdx (#868)

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

Just missing the word `to` in the middle of the sentence.

authored by Zac Ball · committed by GitHub · parent 6e7cd9a · Browse files · 1 file+1 added−1 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+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:website/docs/produce.mdx+1 added-1 removed
32 unmodified lines
33The Immer package exposes a default function that does all the work.3435`produce(currentState, recipe: (draftState) => void): nextState`3637`produce` takes a base state, and a _recipe_ that can be used perform all the desired mutations on the `draft` that is passed in. The interesting thing about Immer is that the `baseState` will be untouched, but the `nextState` will reflect all changes made to `draftState`.37`produce` takes a base state, and a _recipe_ that can be used to perform all the desired mutations on the `draft` that is passed in. The interesting thing about Immer is that the `baseState` will be untouched, but the `nextState` will reflect all changes made to `draftState`.3839Inside the recipe, all standard JavaScript APIs can be used on the `draft` object, including field assignments, `delete` operations, and mutating array, Map and Set operations like `push`, `pop`, `splice`, `set`, `sort`, `remove`, etc.4041Any of those mutations don't have to happen at the root, but it is allowed to modify anything anywhere deep inside the draft: `draft.todos[0].tags["urgent"].author.age = 56`
49 unmodified lines