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) {
9393 } ;
9494}
9595
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+
96106// store
97107
98108const rootReducer = combineReducers ( {
@@ -144,13 +154,13 @@ function TodoItem({ todo, onToggleTodo }) {
144154
145155function mapStateToPropsList ( state ) {
146156 return {
147- todosAsIds : state . todoState . ids ,
157+ todosAsIds : getTodosAsIds ( state ) ,
148158 } ;
149159}
150160
151161function mapStateToPropsItem ( state , props ) {
152162 return {
153- todo : state . todoState . entities [ props . todoId ] ,
163+ todo : getTodo ( state , props . todoId ) ,
154164 } ;
155165}
156166
You can’t perform that action at this time.
0 commit comments