-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: reactIssues related to the Sentry React SDKIssues related to the Sentry React SDK
Description
The reactRouterV#Instrumentation
is no longer supported in React Router v6. Unlike previous versions of React Router, v6 does not expose the history
object.
I've attempted to solve this personally, so as to unblock myself in my projects: react-router-v6-instrumentation
on NPM.
Example usage:
import { init } from '@sentry/react';
import { render } from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import useBrowserTracing from 'react-router-v6-instrumentation';
function App() {
const browserTracing = useBrowserTracing();
// Initialize Sentry with the browser tracing integration.
useEffect(() => {
init({
integrations: [browserTracing],
});
}, [browserTracing]);
return <>Hello world!</>;
}
render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById('root'),
);
I hope this ticket inspires the maintainers to implement (credit? 😆) or unblocks others who are searching for solutions to this issue.
alexvictoor, livthomas, peterhirn, cirdes, jorgeserras and 18 more
Metadata
Metadata
Assignees
Labels
Package: reactIssues related to the Sentry React SDKIssues related to the Sentry React SDK