Last active
May 21, 2018 06:55
-
-
Save teimurjan/4efd2d0fa53e13104320236c41f33590 to your computer and use it in GitHub Desktop.
blog-react-applications-optimization
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
class Todo extends React.Component { | |
handleClick = e => { | |
this.props.onClick(this.props.todo.id); | |
}; | |
render() { | |
return ( | |
<li className="todo" onClick={this.handleClick}> | |
{this.props.todo} | |
</li> | |
); | |
} | |
} | |
class TodoList extends React.PureComponent { | |
render() { | |
return ( | |
<ul> | |
{this.props.todos.map(todo => ( | |
<Todo todo={todo} onClick={this.props.onTodoClick} /> | |
))} | |
</ul> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment