@trackunit/react-core-hooks 0.2.256 → 0.2.257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +6 -4
- package/index.esm.js +6 -4
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -48,10 +48,12 @@ const useAnalytics = (events) => {
|
|
|
48
48
|
throw new Error("useAnalytics must be used within an AnalyticsProvider");
|
|
49
49
|
}
|
|
50
50
|
const logEvent = React.useMemo(() => logEventWithDescription(context.logEvent, events), [context.logEvent, events]);
|
|
51
|
-
return {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
return React.useMemo(() => {
|
|
52
|
+
return {
|
|
53
|
+
...context,
|
|
54
|
+
logEvent,
|
|
55
|
+
};
|
|
56
|
+
}, [context, logEvent]);
|
|
55
57
|
};
|
|
56
58
|
// Automatically append the description from the event type
|
|
57
59
|
const logEventWithDescription = (logEvent, events) => {
|
package/index.esm.js
CHANGED
|
@@ -28,10 +28,12 @@ const useAnalytics = (events) => {
|
|
|
28
28
|
throw new Error("useAnalytics must be used within an AnalyticsProvider");
|
|
29
29
|
}
|
|
30
30
|
const logEvent = useMemo(() => logEventWithDescription(context.logEvent, events), [context.logEvent, events]);
|
|
31
|
-
return {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
return useMemo(() => {
|
|
32
|
+
return {
|
|
33
|
+
...context,
|
|
34
|
+
logEvent,
|
|
35
|
+
};
|
|
36
|
+
}, [context, logEvent]);
|
|
35
37
|
};
|
|
36
38
|
// Automatically append the description from the event type
|
|
37
39
|
const logEventWithDescription = (logEvent, events) => {
|