A react hook to add an event listener to a ref
Arguments | Type | Description | Default value |
---|---|---|---|
eventName | string | The event to track | undefined |
callback | Function | The callback to be called on event | () => void |
conditions | object | The options to be passed to the event listener | |
isLayoutEffect | boolean | Should it use layout effect. Defaults to false | false |
Return value | Type | Description |
---|---|---|
ref | Function | A callback ref that can be used as ref prop |
Join our discord server! You can click the floating discord icon at the bottom right of the screen and chat with us!