File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -173,15 +173,15 @@ store
173
173
// I can also dispatch a thunk async action from a component
174
174
// any time its props change to load the missing data.
175
175
176
- import React from ' react' ;
176
+ import React from ' react'
177
177
import { connect } from ' react-redux'
178
178
179
179
function SandwichShop (props ) {
180
- const { dispatch , forPerson } = props;
180
+ const { dispatch , forPerson } = props
181
181
182
182
useEffect (() => {
183
- dispatch (makeASandwichWithSecretSauce (forPerson));
184
- }, [forPerson]);
183
+ dispatch (makeASandwichWithSecretSauce (forPerson))
184
+ }, [forPerson])
185
185
186
186
return < p> {this .props .sandwiches .join (' mustard' )}< / p>
187
187
}
Original file line number Diff line number Diff line change @@ -70,7 +70,10 @@ function TodoListContainer(props) {
70
70
// We create bound versions of these functions now so we can
71
71
// pass them down to our child later.
72
72
73
- const boundActionCreators = useMemo (() => bindActionCreators (TodoActionCreators, dispatch), [dispatch]);
73
+ const boundActionCreators = useMemo (
74
+ () => bindActionCreators (TodoActionCreators, dispatch),
75
+ [dispatch]
76
+ )
74
77
console .log (boundActionCreators)
75
78
// {
76
79
// addTodo: Function,
@@ -87,7 +90,7 @@ function TodoListContainer(props) {
87
90
// This will work:
88
91
let action = TodoActionCreators .addTodo (' Use Redux' )
89
92
dispatch (action)
90
- }, []);
93
+ }, [])
91
94
92
95
return < TodoList todos= {todos} {... this .boundActionCreators } / >
93
96
You can’t perform that action at this time.
0 commit comments