- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
Supported OS
With the Datadog RUM React integration, resolve performance issues quickly in React components by:
Monitor your React applications from end-to-end by:
Start by setting up Datadog RUM in your React application. If you’re creating a new RUM application in the Datadog App, select React as the application type. If you already have an existing RUM application, you can update its type to React instead. Once configured, the Datadog App will provide instructions for integrating the RUM-React plugin with the Browser SDK.
To track React component rendering errors, use one of the following:
ErrorBoundary
component (see React documentation) that catches errors and reports them to Datadog.ErrorBoundary
component.ErrorBoundary
usageimport { ErrorBoundary } from '@datadog/browser-rum-react'
function App() {
return (
<ErrorBoundary fallback={ErrorFallback}>
<MyComponent />
</ErrorBoundary>
)
}
function ErrorFallback({ resetError, error }) {
return (
<p>
Oops, something went wrong! <strong>{String(error)}</strong> <button onClick={resetError}>Retry</button>
</p>
)
}
ErrorBoundary
import { addReactError } from '@datadog/browser-rum-react'
class MyErrorBoundary extends React.Component {
componentDidCatch(error, errorInfo) {
addReactError(error, errorInfo)
}
render() {
...
}
}
react-router
v6 allows you to declare routes using the following methods:
createMemoryRouter
, createHashRouter
, or createBrowserRouter
functions.useRoutes
hook.Routes
component.To track route changes with the Datadog RUM Browser SDK, first initialize the reactPlugin
with the router: true
option, then replace those functions with their equivalent from @datadog/browser-rum-react/react-router-v6
. Example:
import { RouterProvider } from 'react-router-dom'
import { datadogRum } from '@datadog/browser-rum'
import { reactPlugin } from '@datadog/browser-rum-react'
// Use "createBrowserRouter" from @datadog/browser-rum-react/react-router-v6 instead of react-router-dom:
import { createBrowserRouter } from '@datadog/browser-rum-react/react-router-v6'
datadogRum.init({
...
plugins: [reactPlugin({ router: true })],
})
const router = createBrowserRouter([
{
path: '/',
element: <Root />,
...
},
])
ReactDOM.createRoot(document.getElementById('root')).render(<RouterProvider router={router} />)
Connect your RUM and trace data to get a complete view of your application’s performance. See Connect RUM and Traces.
To start forwarding your React application’s logs to Datadog, see JavaScript Logs Collection.
To generate custom metrics from your RUM application, see Generate Metrics.
Need help? Contact Datadog Support.
Additional helpful documentation, links, and articles: