You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,20 +85,13 @@ Here’s how we hook it up to the Redux Store.
85
85
86
86
We will use `connect()` function provided by `react-redux` to turn a “dumb” `Counter` into a smart component. The `connect()` function lets you specify *which exactly* state from the Redux store your component wants to track. This lets you subscribe on any level of granularity.
87
87
88
-
Passing action creator functions as the second parameter will bind them to the specific store instance, and they will be injected as props with the same names they were exported with.
89
-
90
-
Why don’t we bind action creators to a store right away? This is because of the so-called “universal” apps that need to render on the server. They would have a different store instance for every request, so we don’t know the store instance during the definition!
91
-
92
88
##### `containers/CounterContainer.js`
93
89
94
90
```js
95
91
import { Component } from'react';
96
92
import { connect } from'react-redux';
97
93
98
-
// “Dumb” component:
99
94
importCounterfrom'../components/Counter';
100
-
101
-
// Action creators:
102
95
import { increment } from'../actionsCreators';
103
96
104
97
// Which part of the Redux global state does our component want to receive as props?
@@ -115,13 +108,18 @@ function mapDispatch(dispatch) {
0 commit comments