Created
March 21, 2016 20:06
-
-
Save alexeyzimarev/6bc713076c85e7c5ed21 to your computer and use it in GitHub Desktop.
Todo functional React component
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, { PropTypes } from 'react' | |
const Todo = ({ onClick, completed, text }) => ( | |
<li | |
onClick={onClick} | |
style={{ | |
textDecoration: completed ? 'line-through' : 'none' | |
}} | |
> | |
{text} | |
</li> | |
) | |
Todo.propTypes = { | |
onClick: PropTypes.func.isRequired, | |
completed: PropTypes.bool.isRequired, | |
text: PropTypes.string.isRequired | |
} | |
export default Todo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment