5 hands-on exercises and 5 find-the-bug challenges for the Handling Events lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Show a message when the button is pressed.
Define the handler as a function and pass it by name.
Use an arrow so the handler receives a value.
Use the event object to read the clicked button's id.
Share a handler between buttons by passing a value.
Calling the function passes its result, so it runs once at render and never on click.
React uses camelCase event props, so onclick is ignored.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceAn event prop takes a function, not a quoted string.
Wrap the call in an arrow so it runs on click, not on render.
Both buttons send the same value, so the second does nothing new.