建议在SPA上使用他们的react。https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript-react-plugin
在文档化的示例中,它们手动创建一个浏览器历史记录以传递给扩展。
// AppInsights.js
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
import { ReactPlugin } from '@microsoft/applicationinsights-react-js';
import { createBrowserHistory } from 'history';
const browserHistory = createBrowserHistory({ basename: '' });
const reactPlugin = new ReactPlugin();
const appInsights = new ApplicationInsights({
config: {
instrumentationKey: 'YOUR_INSTRUMENTATION_KEY_GOES_HERE',
extensions: [reactPlugin],
extensionConfig: {
[reactPlugin.identifier]: { history: browserHistory }
}
}
});
appInsights.loadAppInsights();
export { reactPlugin, appInsights };但是,我使用的是react路由器6,我假设它会创建自己的浏览器历史记录。文档确实引用了react路由器文档,但是,这是针对react路由器5的,它确实直接公开了历史记录。
对于react路由器6,访问路由器创建的历史记录的正确方式是什么?
https://stackoverflow.com/questions/70626446
复制相似问题