Skip to content

Commit

Permalink
(examples) improve dispatching
Browse files Browse the repository at this point in the history
  • Loading branch information
vinogradov committed Dec 2, 2017
1 parent 49d8528 commit 8300329
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/examples/redux/one-file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ class Counter$ extends React.Component {
}

fireAction1() {
this.props.dispatch(action1());
this.props.action1();
}

fireAction2() {
this.props.dispatch(action2());
this.props.action2();
}

render() {
Expand All @@ -80,10 +80,11 @@ class Counter$ extends React.Component {
Counter$.propTypes = {
foo: PropTypes.shape().isRequired,
bar: PropTypes.shape().isRequired,
dispatch: PropTypes.func.isRequired
action1: PropTypes.func.isRequired,
action2: PropTypes.func.isRequired
};

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

const store = createStore(
combineReducers({foo, bar}),
Expand Down

0 comments on commit 8300329

Please sign in to comment.