Skip to content

Commit

Permalink
docs: fix typo, INITAL->INITIAL (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
chee authored Jan 26, 2021
1 parent da2bd4f commit 439e4f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/example-reducer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Here is a simple example of the difference that Immer could make in practice.

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

// Reducer with inital state
const INITAL_STATE = {};
const INITIAL_STATE = {};

const byId = produce((draft, action) => {
switch (action.type) {
Expand All @@ -53,7 +53,7 @@ const byId = produce((draft, action) => {
draft[product.id] = product
})
}
}, INITAL_STATE)
}, INITIAL_STATE)
```

Notice that it is not necessary to handle the default case, a producer that doesn't do anything will return the original state.
Expand Down

0 comments on commit 439e4f1

Please # to comment.