v8.1.0 - Full React Hooks support
Thanks to @bgergen in #168 and #171 (testing support from @tizmagik in #165 and #170 ) react-tracking now fully supports React Hooks for all features (e.g. Hooks can be used completely instead of, or in addition to, the HoC/decorator API).
import { useTracking } from 'react-tracking';
const FooPage = () => {
const { Track, trackEvent } = useTracking({ page: 'FooPage' });
return (
<Track>
<div
onClick={() => {
trackEvent({ action: 'click' });
}}
/>
</Track>
);
};
See the full docs in the main README starting here.