callAllHandlers

callAllHandlers is a utility that combines multiple functions and call them at once.

Import#

import { callAllHandlers } from '@dwarvesf/react-utils'

Return value#

The callAllHandlers triggers all functions passed in and return undefined:

Usage#

function Example() {
function CustomButton(props) {
return (
<Button onClick={callAllHandlers(props.onClick, () => alert('2'))}>
Click me
</Button>
)
}
return <CustomButton onClick={() => alert(1)} />
}
Edit this page

Made with ❤️ by Dwarves Foundation