JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9322
  • Score
    100M100P100Q127591F
  • License MIT

The official React package for Axiom

Package Exports

  • @axiomhq/react
  • @axiomhq/react/package.json

Readme

Axiom React library

The @axiomhq/react package allows you to send data from a React app to Axiom.

// lib/axiom/client.ts
'use client';

import axiomClient from '@/lib/axiom/axiom';
import { Logger, ConsoleTransport, AxiomJSTransport } from '@axiomhq/logging';
import { createUseLogger, createWebVitalsComponent } from '@axiomhq/react';

export const logger = new Logger({
  transports: [
    new AxiomJSTransport({ axiom: axiomClient, dataset: process.env.AXIOM_DATASET! }),
    new ConsoleTransport(),
  ],
});

const useLogger = createUseLogger(logger);
const WebVitals = createWebVitalsComponent(logger);

export { useLogger, WebVitals };

Install

npm install @axiomhq/js @axiomhq/logging @axiomhq/react

Documentation

For more information about how to set up and use the @axiomhq/react package, see the axiom.co/docs/send-data/react.

License

MIT