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 da448c5380..79af8c61b6 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 @@ -2,9 +2,30 @@ title: Use the Spread Operator on Arrays --- ## Use the Spread Operator on Arrays - -This is a stub. Help our community expand it. - -This quick style guide will help ensure your pull request gets accepted. - + + +## Solution + +```javascript +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); + return arr; + default: + return state; + } +}; + +const addToDo = (todo) => { + return { + type: 'ADD_TO_DO', + todo + } +} + +const store = Redux.createStore(immutableReducer); +```