I'm new to ES6. Got a bit confused on different ways to write a React component. I started with a "React.createClass" then moved to "extends React.Component" with ES6 classes syntax.
Following Redux tutorial now I see they define components in this way
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
How can I refactor this "function" moving to a ES6 class which extends React.component? I guess the return JSX is the render() method, isn't it? What about onClick, completed, text arguments?
Thank you