Skip to main content



The useEvent React Hook allows us to register a new callback function to the passed Event.

useEvent(MY_EVENT, () => {
// This is a 'callback function' which gets called when ever the EVENT gets triggered

The advantage of using this Hook instead of the on method in a React Component, is that the registered callback function gets automatically unregistered whenever the Component unmounts.

🔴 Example

Live Editor

🟦 Typescript

useEvent is almost 100% typesafe.

📭 Props

eventEvent (E)Event to which the passed callback function gets applied.Yes
callbackEventCallbackFunction<E['payload']>Callback Function that gets applied to the passed EventYes
keystring | numberKey/Name of created Observer. Mainly thought for Debugging.No
agileInstanceAgileTo which Agile Instance the Event get bound. Gets autodetect!No

📄 Return

useEvent returns nothing.