File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,16 @@ function doSetFilter(filter) {
93
93
} ;
94
94
}
95
95
96
+ // selectors
97
+
98
+ function getTodosAsIds ( state ) {
99
+ return state . todoState . ids ;
100
+ }
101
+
102
+ function getTodo ( state , todoId ) {
103
+ return state . todoState . entities [ todoId ] ;
104
+ }
105
+
96
106
// store
97
107
98
108
const rootReducer = combineReducers ( {
@@ -144,13 +154,13 @@ function TodoItem({ todo, onToggleTodo }) {
144
154
145
155
function mapStateToPropsList ( state ) {
146
156
return {
147
- todosAsIds : state . todoState . ids ,
157
+ todosAsIds : getTodosAsIds ( state ) ,
148
158
} ;
149
159
}
150
160
151
161
function mapStateToPropsItem ( state , props ) {
152
162
return {
153
- todo : state . todoState . entities [ props . todoId ] ,
163
+ todo : getTodo ( state , props . todoId ) ,
154
164
} ;
155
165
}
156
166
You can’t perform that action at this time.
0 commit comments