Higher Order React Component for Click Tracking
问题 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,