nytimes / react-tracking

🎯 Declarative tracking for React apps.
https://open.nytimes.com/introducing-react-tracking-declarative-tracking-for-react-apps-2c76706bb79a
Other
1.88k stars 123 forks source link

React Hooks API? #120

Closed alloy closed 5 years ago

alloy commented 5 years ago

Given that React Hooks are now here to stay and more and more people are eager to use them, I was wondering if you have started thinking about a future version of react-tracking that would integrate well with this new landscape?

Specifically, we can’t add decorators to functions and I’d really like to keep separating business logic from inline analytics calls–while keeping them clearly ‘attached’ to it.

tizmagik commented 5 years ago

Yea I’ve been thinking about how best to approach this. The ideal interface I think would be something like useTracking() which could encapsulate the context propagation and everything else we support today with the decorator syntax.

I haven’t had time to create a POC/start a PR, but if anyone’s interested, please feel free and we can iterate.