Skip to content

Commit

Permalink
Merge branch 'patch-1' of https://github.com/pvcresin/immer into pvcr…
Browse files Browse the repository at this point in the history
…esin-patch-1
  • Loading branch information
mweststrate committed Mar 17, 2021
2 parents 42aac95 + 12a1c67 commit ec03dd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/types/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ interface IProduce {
recipe: (draftState: S) => S | void,
patchListener?: PatchListener
): S;
// curried invocations with inital state
// curried invocations with initial state
<S: Base, A = void, B = void, C = void>(
recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void,
initialState: S
): (currentState: S | void, a: A, b: B, c: C, ...extraArgs: any[]) => S;
// curried invocations without inital state
// curried invocations without initial state
<S: Base, A = void, B = void, C = void>(
recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void
): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S;
Expand All @@ -50,12 +50,12 @@ interface IProduceWithPatches {
currentState: S,
recipe: (draftState: S) => S | void
): [S, Patch[], Patch[]];
// curried invocations with inital state
// curried invocations with initial state
<S: Base, A = void, B = void, C = void>(
recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void,
initialState: S
): (currentState: S | void, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]];
// curried invocations without inital state
// curried invocations without initial state
<S: Base, A = void, B = void, C = void>(
recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void
): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]];
Expand Down
7 changes: 4 additions & 3 deletions website/docs/example-reducer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ title: Example Reducer
data-ea-type="image"
className="horizontal bordered"
></div>
</center> <details>
</center>
<details>
<summary className="egghead-summary">
egghead.io lesson 13: Using Immer in a (React) reducer
</summary>
Expand All @@ -33,7 +34,7 @@ title: Example Reducer
Here is a simple example of the difference that Immer could make in practice.

```javascript
// Reducer with inital state
// Reducer with initial state
const INITIAL_STATE = {}
// Shortened, based on: https://github.com/reactjs/redux/blob/master/examples/shopping-cart/src/reducers/products.js
const byId = (state = INITIAL_STATE, action) => {
Expand All @@ -57,7 +58,7 @@ After using Immer, our reducer can be expressed as:
```javascript
import produce from "immer"

// Reducer with inital state
// Reducer with initial state
const INITIAL_STATE = {}

const byId = produce((draft, action) => {
Expand Down

0 comments on commit ec03dd0

Please sign in to comment.