Skip to content

Commit baff262

Browse files
committed
Update README.md
1 parent ca2afa0 commit baff262

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,13 @@ Here’s how we hook it up to the Redux Store.
8585

8686
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.
8787

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-
9288
##### `containers/CounterContainer.js`
9389

9490
```js
9591
import { Component } from 'react';
9692
import { connect } from 'react-redux';
9793

98-
// “Dumb” component:
9994
import Counter from '../components/Counter';
100-
101-
// Action creators:
10295
import { increment } from '../actionsCreators';
10396

10497
// Which part of the Redux global state does our component want to receive as props?
@@ -115,13 +108,18 @@ function mapDispatch(dispatch) {
115108
};
116109
}
117110

118-
export default connect(mapState, mapDispatch)(CounterContainer);
111+
export default connect(
112+
mapState,
113+
mapDispatch
114+
)(CounterContainer);
119115

120116
// You can also pass an object instead of defining `mapDispatch`:
121117
// export default connect(mapState, CounterActionCreators)(CounterContainer);
122118

123119
// Or you can pass `dispatch` down as a prop if you omit `mapDispatch`:
124120
// export default connect(mapState)(CounterContainer);
121+
122+
// See more recipes in detailed connect() examples below.
125123
```
126124

127125
Whether to put `connect()` call in the same file as the “dumb” component, or separately, is up to you.

0 commit comments

Comments
 (0)