Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/instrument/faro-react/server-side-rendering.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/instrument/faro-react/server-side-rendering/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
React server side rendering support
Follow this guide to learn how to initialize your Faro instrumentation to support React Server Side Rendering (SSR) for:
- React Router v6 without a data router
- React Router v6 with a data router
- React Router v5
React Router v6 without a data router
import { FaroErrorBoundary, setReactRouterV6SSRDependencies } from '@grafana/faro-react';
setReactRouterV6SSRDependencies({ Routes });
export function renderToString(...) {
return reactRenderToString(
<FaroErrorBoundary>
<StaticRouter location={...}>
<App />
</StaticRouter>
</FaroErrorBoundary>
),
}React Router v6 with a data router
Wrap your data router with withFaroRouterInstrumentation(dataRouter) in your routes file.
// example
React Router v5
import { FaroErrorBoundary, setReactRouterV4V5SSRDependencies } from '@grafana/faro-react';
setReactRouterV4V5SSRDependencies({ Route, history });
export function renderToString(...) {
return reactRenderToString(
<FaroErrorBoundary>
<StaticRouter location={...}>
<App />
</StaticRouter>
</FaroErrorBoundary>
),
}Was this page helpful?
Related resources from Grafana Labs


