high-order-component

Higher Order React Component for Click Tracking

与世无争的帅哥 提交于 2020-01-21 11:13:14
问题 I'd like to implement a higher order react component which can be used to easily track events (like a click) on any React component. The purpose of this is to easily hook clicks (and other events) into our first party analytics tracker. The challenge I've come across is that the React synthetic event system requires events (like onClick ) be bound to react DOM elements, like a div . If the component I'm wrapping is a custom component, like every HOC implemented via a higher order function is,

Higher Order React Component for Click Tracking

可紊 提交于 2020-01-21 11:12:58
问题 I'd like to implement a higher order react component which can be used to easily track events (like a click) on any React component. The purpose of this is to easily hook clicks (and other events) into our first party analytics tracker. The challenge I've come across is that the React synthetic event system requires events (like onClick ) be bound to react DOM elements, like a div . If the component I'm wrapping is a custom component, like every HOC implemented via a higher order function is,