React
Applies to@openrum/browser 0.1.2
Before you start, install the SDK and copy the Project’s DSN as described in the Browser SDK overview. Add your app’s origin to the Project’s allowed origins.
Initialize
Section titled “Initialize”import { init } from "@openrum/browser";
init({ dsn: import.meta.env.VITE_OPENRUM_DSN, environment: import.meta.env.MODE, release: import.meta.env.VITE_APP_RELEASE,});import "./monitoring.ts";import { createRoot } from "react-dom/client";Importing the module for its side effect keeps initialization out of a component, so it
cannot run twice under Strict Mode or on a re-render. Client-side navigations are captured
without extra wiring, because React Router navigates through history.pushState.
Run the example
Section titled “Run the example”A runnable version lives at examples/react-vite:
cp examples/react-vite/.env.example examples/react-vite/.env.localpnpm --filter @openrum/example-react-vite devNext steps
Section titled “Next steps”- Verify that capture, ingest and aggregation agree.
- Upload Source Maps for React (Vite) so production errors map back to source.
Release Alpha · commit local