From 9db0c57a83661a240effc3db7a32130b129f21ce Mon Sep 17 00:00:00 2001 From: Brian Hartz Date: Fri, 7 Aug 2015 16:45:19 -0600 Subject: [PATCH] update counter example --- examples/counter/containers/CounterApp.js | 19 ++++++------------- examples/counter/package.json | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/examples/counter/containers/CounterApp.js b/examples/counter/containers/CounterApp.js index d97d02dfcb..c5c7021eb3 100644 --- a/examples/counter/containers/CounterApp.js +++ b/examples/counter/containers/CounterApp.js @@ -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 ( - - ); +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); diff --git a/examples/counter/package.json b/examples/counter/package.json index dfa1ffed74..5a9eaaa6f7 100644 --- a/examples/counter/package.json +++ b/examples/counter/package.json @@ -29,7 +29,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" },