File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class TodoItem extends Component {
46
46
} else {
47
47
element = (
48
48
< div className = "view" >
49
- < input
49
+ < input
50
50
className = "toggle"
51
51
type = "checkbox"
52
52
checked = { isCompleted }
@@ -80,16 +80,21 @@ TodoItem.propTypes = {
80
80
completeTodo : PropTypes . func . isRequired
81
81
}
82
82
83
- const mapStateToProps = ( { todos } , { id } ) => {
84
- const todo = todos . byId [ id ]
85
- return {
86
- todo,
87
- isCompleted : todos . isCompletedById [ id ] ,
88
- isRelatedTodoCompleted : todos . isCompletedById [ todo . relatedId ]
83
+ const makeMapStateToProps = ( initialState , initialProps ) => {
84
+ const { id } = initialProps
85
+ const mapStateToProps = ( state ) => {
86
+ const { todos } = state
87
+ const todo = todos . byId [ id ]
88
+ return {
89
+ todo,
90
+ isCompleted : todos . isCompletedById [ id ] ,
91
+ isRelatedTodoCompleted : todos . isCompletedById [ todo . relatedId ]
92
+ }
89
93
}
94
+ return mapStateToProps
90
95
}
91
96
92
97
export default connect (
93
- mapStateToProps ,
98
+ makeMapStateToProps ,
94
99
{ completeTodo, editTodo, deleteTodo }
95
100
) ( TodoItem )
Original file line number Diff line number Diff line change 23
23
"pure-render-mixin" : " ^1.0.2" ,
24
24
"react" : " ^0.14.7" ,
25
25
"react-dom" : " ^0.14.7" ,
26
- "react-redux" : " ^4.4.1 " ,
26
+ "react-redux" : " ^4.4.4 " ,
27
27
"redux" : " ^3.3.1" ,
28
28
"reselect" : " ^2.3.0"
29
29
},
You can’t perform that action at this time.
0 commit comments