Skip to content

Commit fd12a90

Browse files
committed
Merge pull request reduxjs#1468 from just-boris/master
tree-view: simplify reducer function
2 parents 13af173 + 4a80c20 commit fd12a90

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

examples/tree-view/reducers/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ function childIds(state, action) {
55
case ADD_CHILD:
66
return [ ...state, action.childId ]
77
case REMOVE_CHILD:
8-
const index = state.indexOf(action.childId)
9-
return [
10-
...state.slice(0, index),
11-
...state.slice(index + 1)
12-
]
8+
return state.filter(id => id !== action.childId)
139
default:
1410
return state
1511
}

0 commit comments

Comments
 (0)