React Events
Respond to user actions with handlers like onClick and onChange. Pass a function; React calls it when the event happens.
function Button() {
function handleClick() { alert("Clicked!") }
return <button onClick={handleClick}>Click me</button>
}
Try it yourself
Loading editor…