Skip to content

Instantly share code, notes, and snippets.

@alexeyzimarev
Created March 21, 2016 20:06
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 alexeyzimarev/6bc713076c85e7c5ed21 to your computer and use it in GitHub Desktop.
Save alexeyzimarev/6bc713076c85e7c5ed21 to your computer and use it in GitHub Desktop.
Todo functional React component
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