-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Description
Description/Screenshot
I have below React component
`
import React from "react";
import { useAppInsightsContext } from "@microsoft/applicationinsights-react-js";
const TestComponent = () => {
const { trackEvent } = useAppInsightsContext();
function onClick() {
trackEvent({ name: "TestComponent test" });
}
return (
<div className="App">
<div>
<button onClick={onClick}>Add Number</button>
</div>
</div>
);
};
export default TestComponent;
`
When I click the Add Number button, I am getting bellow error message:

My Application Insights instance is set up as below
Steps to Reproduce
- OS/Browser: MacOS Sonoma 14.6.1, Chrome 129.0.6668.100 (arm64)
- React Version: 17.0.2, same happens with 18.3.1
- SDK Version [e.g. 22]: 17.3.3
- How you initialized the SDK:
Expected behavior
Error should not be displayed and event should be sent to Application Insights.
Additional context
Add any other context about the problem here.
When using reactPlugin instance directly and calling reactPlugin.trackEvent works.
