Last active
June 13, 2019 16:04
-
-
Save kayode-adechinan/c0e3a51fea62caee14248659af7a9730 to your computer and use it in GitHub Desktop.
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 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