From 586730b69a2b35e0b92930ebdeca6fbf553ef7f6 Mon Sep 17 00:00:00 2001 From: Andrew Ma Date: Sun, 5 May 2019 12:40:32 -0500 Subject: [PATCH] better solution to redux spread operator (#35592) 2 step -> 1 step --- .../redux/use-the-spread-operator-on-arrays/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guide/english/certifications/front-end-libraries/redux/use-the-spread-operator-on-arrays/index.md b/guide/english/certifications/front-end-libraries/redux/use-the-spread-operator-on-arrays/index.md index 79af8c61b6..8f9b9fad41 100644 --- a/guide/english/certifications/front-end-libraries/redux/use-the-spread-operator-on-arrays/index.md +++ b/guide/english/certifications/front-end-libraries/redux/use-the-spread-operator-on-arrays/index.md @@ -12,8 +12,7 @@ const immutableReducer = (state = ['Do not mutate state!'], action) => { switch(action.type) { case 'ADD_TO_DO': // don't mutate state here or the tests will fail - let arr = [...state]; - arr.push(action.todo); + let arr = [...state, action.todo]; return arr; default: return state;