Skip to content

Commit

Permalink
Merge pull request #453 from hartzis/update-counter-example
Browse files Browse the repository at this point in the history
Update counter example to recent react-redux
  • Loading branch information
gaearon committed Aug 10, 2015
2 parents 27fa07c + 9db0c57 commit f0132a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions examples/counter/containers/CounterApp.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import Counter from '../components/Counter';
import * as CounterActions from '../actions/CounterActions';

class CounterApp extends Component {
render() {
const { counter, dispatch } = this.props;
return (
<Counter counter={counter}
{...bindActionCreators(CounterActions, dispatch)} />
);
function mapStateToProps(state) {
return {
counter: state.counter
}
}

function select(state) {
return {
counter: state.counter
};
function mapDispatchToProps(dispatch) {
return bindActionCreators(CounterActions, dispatch);
}

export default connect(select)(CounterApp);
export default connect(mapStateToProps, mapDispatchToProps)(Counter);
2 changes: 1 addition & 1 deletion examples/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"homepage": "https://github.com/gaearon/redux#readme",
"dependencies": {
"react": "^0.13.3",
"react-redux": "^0.4.0",
"react-redux": "^0.8.0",
"redux": "^1.0.0-rc",
"redux-thunk": "^0.1.0"
},
Expand Down

0 comments on commit f0132a0

Please sign in to comment.