Last active
August 14, 2016 05:34
-
-
Save samcorcos/2e1e06e5e4e978ad783d833919ea3d9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { connect } from 'react-redux' | |
import Actions from './Actions.js' | |
class App extends React.Component { | |
constructor(props) { | |
super(props) | |
this.addOne = this.addOne.bind(this) | |
} | |
addOne() { | |
this.props.dispatch(Actions.addOne()) | |
} | |
render() { | |
return ( | |
<div> | |
<button | |
onClick={ this.addOne }> | |
Increment | |
</button> | |
{ this.props.counter } | |
</div> | |
) | |
} | |
} | |
const mapStateToProps = store => { | |
return { | |
counter: store.counter | |
} | |
} | |
export default connect(mapStateToProps)(App) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was brought here from a react article hosted at medium. Thanks for sharing. 👍
I had one question for clarification.
line #28 - 32, can that be simplified further?
Please let me know your thoughts on this.