Skip to content

Instantly share code, notes, and snippets.

@adnaan
Last active November 6, 2016 09:46
Show Gist options
  • Save adnaan/4ddbe43328cf2baed0024d8cb9db9284 to your computer and use it in GitHub Desktop.
Save adnaan/4ddbe43328cf2baed0024d8cb9db9284 to your computer and use it in GitHub Desktop.
/*@flow*/
import React from 'react';
import FaCaretUp from 'react-icons/lib/fa/caret-up';
function Product(props: { id: number, title: string, vote: number, dispatch: Function }) {
const { id, title, vote } = props;
function handleVote() {
props.dispatch({
type: 'products/vote',
id: id,
});
}
return (
<div>
<div>
{vote}
<FaCaretUp onClick={handleVote} />
{title}
</div>
</div>
);
}
export default Product;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment