react-behave
Version:
A library of behaviors for React applications.
22 lines (20 loc) • 525 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.callHandlers = callHandlers;
function callHandlers(event, handlers) {
handlers.forEach(function (handler) {
// Ingore falsy handlers to allow syntaxes like:
//
// ```js
// const child = React.Children.only(this.props.children)
// return React.cloneElement(child, {
// onClick: e => callHandlers(e, [this.handleClick, child.onClick])
// })
// ```
if (handler) {
handler(event);
}
});
}