Skip to content

Commit 8300329

Browse files
author
vinogradov
committed
(examples) improve dispatching
1 parent 49d8528 commit 8300329

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/examples/redux/one-file/index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class Counter$ extends React.Component {
5858
}
5959

6060
fireAction1() {
61-
this.props.dispatch(action1());
61+
this.props.action1();
6262
}
6363

6464
fireAction2() {
65-
this.props.dispatch(action2());
65+
this.props.action2();
6666
}
6767

6868
render() {
@@ -80,10 +80,11 @@ class Counter$ extends React.Component {
8080
Counter$.propTypes = {
8181
foo: PropTypes.shape().isRequired,
8282
bar: PropTypes.shape().isRequired,
83-
dispatch: PropTypes.func.isRequired
83+
action1: PropTypes.func.isRequired,
84+
action2: PropTypes.func.isRequired
8485
};
8586

86-
const Counter = connect(({foo, bar}) => ({foo, bar}))(Counter$); // eslint-disable-line no-shadow
87+
const Counter = connect(({foo, bar}) => ({foo, bar}), {action1, action2})(Counter$); // eslint-disable-line no-shadow
8788

8889
const store = createStore(
8990
combineReducers({foo, bar}),

0 commit comments

Comments
 (0)