Skip to content

Commit

Permalink
Update Troubleshooting.md to properly indent switch
Browse files Browse the repository at this point in the history
  • Loading branch information
ellbee committed Nov 30, 2015
1 parent df5ee6b commit d96c384
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions docs/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ For example, a reducer like this is wrong because it mutates the state:
```js
function todos(state = [], action) {
switch (action.type) {
case 'ADD_TODO':
// Wrong! This mutates state
state.push({
text: action.text,
completed: false
})
return state
case 'COMPLETE_TODO':
// Wrong! This mutates state[action.index].
state[action.index].completed = true
return state
default:
return state
case 'ADD_TODO':
// Wrong! This mutates state
state.push({
text: action.text,
completed: false
})
return state
case 'COMPLETE_TODO':
// Wrong! This mutates state[action.index].
state[action.index].completed = true
return state
default:
return state
}
}
```
Expand Down

0 comments on commit d96c384

Please sign in to comment.