Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/instrument/faro-react/upgrade-data-router.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/instrument/faro-react/upgrade-data-router/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
Upgrade to React Router v6 with a data router
This section describes how to upgrade the Faro React router instrumentation if you already have a React app instrumented which doesn’t use data routers.
In the ReactIntegration call, change the version property from ReactRouterVersion.[V4|V5|V6] to ReactRouterVersion.V6_data_router.
If you use React Router v4 or v5 remove the history and Route dependencies and add the matchRoutes function exported by react-router-dom.
If you use React Router v6 remove the following dependencies from the dependencies object:
createRoutesFromChildrenRoutesuseLocationuseNavigationType
The ReactIntegration call should look similar to:
import { matchRoutes } from 'react-router-dom';
import { getWebInstrumentations, initializeFaro, ReactIntegration, ReactRouterVersion } from '@grafana/faro-react';
initializeFaro({
// ...
instrumentations: [
// Load the default Web instrumentations
...getWebInstrumentations(),
new ReactIntegration({
router: {
version: ReactRouterVersion.V6_data_router,
dependencies: {
matchRoutes,
},
},
}),
],
});Next you need to remove the Faro route components <FaroRoute/> or <FaroRoutes/> and instrument the data router.
Was this page helpful?
Related resources from Grafana Labs


