Created
June 5, 2025 08:53
-
-
Save dkacper/e49435b394cb5e9ab9246c373826d2e6 to your computer and use it in GitHub Desktop.
Compose handlers of your react component.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const composeHandlers = (...handlers: unknown[]) => { | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
return (...args: any[]) => { | |
for (const handler of handlers) { | |
if (typeof handler === 'function') { | |
handler(...args); | |
} | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment