Skip to content

Instantly share code, notes, and snippets.

@kayode-adechinan
Last active June 13, 2019 16:04
Show Gist options
  • Save kayode-adechinan/c0e3a51fea62caee14248659af7a9730 to your computer and use it in GitHub Desktop.
Save kayode-adechinan/c0e3a51fea62caee14248659af7a9730 to your computer and use it in GitHub Desktop.
class EventHandlingDemo extends React.Component {
render() {
return (
<div>
<button onClick={this.handleClick}>
ADD
</button>
<input onChange={this.handleInput}/>
{
this.state.todos.map((item) => {
return (
<li onClick={this.handleRemove(item.id)}>
{item.text}
</li>
);
});
}
</div>
)
}
handleClick = () => {
// "this"
}
handleInput = (e) => {
// "this", "e"
}
handleRemove = (id) => (e) => {
// "this", "e", "id"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment