---
title: Responding to Events
---
React lets you add *event handlers* to your JSX. Event handlers are your own functions that will be triggered in response to interactions like clicking, hovering, focusing form inputs, and so on.
* Different ways to write an event handler
* How to pass event handling logic from a parent component
* How events propagate and how to stop them
## Adding event handlers {/*adding-event-handlers*/}
To add an event handler, you will first define a function and then [pass it as a prop](/learn/passing-props-to-a-component) to the appropriate JSX tag. For example, here is a button that doesn't do anything yet:
```js
export default function Button() {
return (
);
}
```
You can make it show a message when a user clicks by following these three steps:
1. Declare a function called `handleClick` *inside* your `Button` component.
2. Implement the logic inside that function (use `alert` to show the message).
3. Add `onClick={handleClick}` to the `