Skip to content

Instantly share code, notes, and snippets.

@jonnyreeves
Created May 30, 2016 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonnyreeves/bc53e56c2d924d083b1fefde8c75aea9 to your computer and use it in GitHub Desktop.
Save jonnyreeves/bc53e56c2d924d083b1fefde8c75aea9 to your computer and use it in GitHub Desktop.
redux-middleware-counter.js
const Counter = props => {
const { count, dispatch } = props;
return (
<div>
<p>Counter value: {props.value}</p>
<button onClick={() => dispatch({ type: 'INC' })}>++</button>
<button onClick={() => dispatch({ type: 'DEC' })}>--</button>
</div>
);
}
export default connect(state => state)(Counter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment