Last active
November 6, 2016 09:46
-
-
Save adnaan/4ddbe43328cf2baed0024d8cb9db9284 to your computer and use it in GitHub Desktop.
This file contains 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
/*@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