Skip to content

Commit d96c384

Browse files
committed
Update Troubleshooting.md to properly indent switch
1 parent df5ee6b commit d96c384

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/Troubleshooting.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ For example, a reducer like this is wrong because it mutates the state:
2020
```js
2121
function todos(state = [], action) {
2222
switch (action.type) {
23-
case 'ADD_TODO':
24-
// Wrong! This mutates state
25-
state.push({
26-
text: action.text,
27-
completed: false
28-
})
29-
return state
30-
case 'COMPLETE_TODO':
31-
// Wrong! This mutates state[action.index].
32-
state[action.index].completed = true
33-
return state
34-
default:
35-
return state
23+
case 'ADD_TODO':
24+
// Wrong! This mutates state
25+
state.push({
26+
text: action.text,
27+
completed: false
28+
})
29+
return state
30+
case 'COMPLETE_TODO':
31+
// Wrong! This mutates state[action.index].
32+
state[action.index].completed = true
33+
return state
34+
default:
35+
return state
3636
}
3737
}
3838
```

0 commit comments

Comments
 (0)