react-datadog
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

React Datadog

CI/CD version downloads

react-datadog is a React hook for instantiating Datadog RUM in your React application.

Use

import useDatadog from 'react-datadog';

export default function App() {
  useDatadog({
    applicationId: 'a0b1c2d3-e4f5-a6b7-c8d9-e0f1a2b3c4d5',
    clientToken: 'puba0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5',
    service: 'my-service',
    sessionReplayRecording: true,
  });

  return <>Hello world!</>;
}

Exports

useDatadog

import useDatadog from 'react-datadog';'

In addition to the RUM init configuration, the useDatadog hooks also accepts additional props:

enabled

Type: boolean (default: true)

Unless explicitly set to false, the useDatadog hook will automatically initialize on mount.

sessionReplayRecording

Type: boolean (default: true)

Unless explicitly set to false, the useDatadog hook will automatically start session replay recording on mount (and stop session replay recording on unmount).

useDatadogRum

import { useDatadogRum } from 'react-datadog';

Not to be confused with the useDatadog default export, the useDatadogRum hook returns the Datadog RUM object. While this is currently equivalent to import { datadogRum } from '@datadog/browser-rum';, this hook allows future extensibility with React context.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.1
0latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.1
0
3.0.011
2.0.3749
2.0.2542
2.0.1260
2.0.00
1.2.2295
1.2.14
1.2.00
1.1.012
1.0.221
1.0.10
1.0.00

Package Sidebar

Install

npm i react-datadog

Weekly Downloads

1,894

Version

3.0.1

License

MIT

Unpacked Size

27.5 kB

Total Files

48

Last publish

Collaborators

  • charlesstover