Last active
June 17, 2017 11:46
-
-
Save paulsturgess/db388c5f981775e96d8cb33d9fdcf073 to your computer and use it in GitHub Desktop.
Example stateless 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