Grokking React Fundamentals
0% completed
Passing Arguments to Event Handlers
Three color buttons, Red, Green and Blue, can share a single click handler. The shared handler then has a problem to solve: when it runs, it must know which of the three buttons was clicked. This lesson builds a small color picker and shows two ways to give the handler that information, first through the event object and then through an argument of your own.
The Event Object
When React calls an event handler, it passes one argument: an object that describes the event. This event object has a type property, such as 'click', and a `target
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%