From 439e4f1d7d2a1825ed3479a4c7da4b6138e7af48 Mon Sep 17 00:00:00 2001 From: chee Date: Tue, 26 Jan 2021 16:46:22 +0000 Subject: [PATCH] docs: fix typo, INITAL->INITIAL (#741) --- docs/example-reducer.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/example-reducer.md b/docs/example-reducer.md index 701d3804..b675db55 100644 --- a/docs/example-reducer.md +++ b/docs/example-reducer.md @@ -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 { @@ -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) { @@ -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.