File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
examples/todomvc/containers Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,7 @@ import * as TodoActions from '../actions/todos';
7
7
8
8
class App extends Component {
9
9
render ( ) {
10
- const { todos, dispatch } = this . props ;
11
- const actions = bindActionCreators ( TodoActions , dispatch ) ;
12
-
10
+ const { todos, actions } = this . props ;
13
11
return (
14
12
< div >
15
13
< Header addTodo = { actions . addTodo } />
@@ -21,7 +19,7 @@ class App extends Component {
21
19
22
20
App . propTypes = {
23
21
todos : PropTypes . array . isRequired ,
24
- dispatch : PropTypes . func . isRequired
22
+ actions : PropTypes . object . isRequired
25
23
} ;
26
24
27
25
function mapStateToProps ( state ) {
@@ -30,4 +28,13 @@ function mapStateToProps(state) {
30
28
} ;
31
29
}
32
30
33
- export default connect ( mapStateToProps ) ( App ) ;
31
+ function mapDispatchToProps ( dispatch ) {
32
+ return {
33
+ actions : bindActionCreators ( TodoActions , dispatch )
34
+ } ;
35
+ }
36
+
37
+ export default connect (
38
+ mapStateToProps ,
39
+ mapDispatchToProps
40
+ ) ( App ) ;
You can’t perform that action at this time.
0 commit comments