---
schema_version: "1"
id: 60b0d59bf7887a33afd03d57066105f059058aac8294169831d0b9028845b235
title: Component Handling Its Own Event
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/events/events-component-handling-itself.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/events-component-handling-itself.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c2ef5a21b497f626a9ffef8c9b5b18d0b095b7ab05618858219aacb133b65602
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Component Handling Its Own Event

A component can handle its own event by using the `<aura:handler>` tag in its markup.

The `action` attribute of `<aura:handler>` sets the client-side controller action to handle the event. For example:

```javascript
<aura:registerEvent name="sampleComponentEvent" type="c:compEvent"/>
<aura:handler name="sampleComponentEvent" event="c:compEvent"
    action="{!c.handleSampleEvent}"/>

```

**note:** The `name` attributes in `<aura:registerEvent>` and `<aura:handler>` must match, since each event is defined by its name.

**See Also**  


-   [Handle Component Event of Instantiated Component](https://developer.salesforce.com/docs/platform/aura-platform/guide/events-component-handling-child.md)

