-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
override default useTracking
behaviour
#166
Comments
useTracking
behaviouruseTracking
behaviour
Hello @huguesbr -- good question. The reason we throw an error when there's no context in the tree is to warn in the case the user forgot to establish react-tracking context before attempting to dispatch tracking events or to track components within the tree, it helps catch easy to miss cases where components that are expected to be tracked are included just outside the tracked root. Can you help me understand your use case a bit better? Why not wrap your admin example with a And yeap the reason we don't export the tracking context is to avoid exposing the internal API. In the future, the work in #138 may actually obviate the need for this since using the |
Yes I'm following #138 really closely as the need to define context with functional comp is a core for us. There is lot of different reasons why we don't want to have top comp defining a context. But the main one is being is being avoiding code where there should be none ^^ An App,we shouldn't track should be able to use a comp that track if within a tracking context? Our current solution works but really on exposure of context. If Also for specs we've found the need to redefine So I think the need to either work in an unexpected context (to increase comp re-usability) or ability to be shortcuted (in context of test) is nice. But nothing we can't handle ourselves ^^ (so far) so great work! So please keep an option open for exposing some internal if needed, with warning if unsafe ^^ |
This should be easier to do now with the release of v8.1.0 |
oh my https://github.com/nytimes/react-tracking/releases/tag/v8.1.0 is a gem! full support of react hooks is a blast! congrats! will close now, thx! |
Hi,
We have multiple React App (we're using
rails-react
), but we have some component shared by all our App (let's say a button) which make usage of tracking.For some of our App it doesn't make sense to track anything (let's say admin).
We would like to change default behaviour of
useTracking
which raise if context is not defined, by returning a no-op instead.The issue is
ReactTrackingContext
is not exposed by thereact-tracking
I guess I could do something like
Any reason (beside exposing internal API) is not exposed?
The text was updated successfully, but these errors were encountered: