npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tracex-dev/react

v0.1.1

Published

TraceX SDK for React and browser applications

Readme

@tracex-dev/react

License: MIT npm version

TraceX Crash Observability, DOM Interaction Tracking, and Error Boundary SDK for React (supports React 16.8+, React 18, and React 19).

Captures unhandled render crashes, records user click breadcrumbs with strict PII filtering, and monitors single-page application (SPA) client navigation.


Features

  • <TraceXErrorBoundary>: Catches React component render crashes, captures componentStack, emits mechanism: react.error_boundary, and renders customizable or default fallback UI with recovery reset triggers.
  • withTraceXErrorBoundary HOC: Higher-Order Component wrapper for decorating components with error boundaries.
  • <TraceXProvider> & Hooks: Context provider exposing useTraceX(), useCaptureException(), and useAddBreadcrumb().
  • DOM Click Tracking: Automatically captures click breadcrumbs on interactive elements (buttons, links, inputs). Strictly ignores password/email inputs and elements tagged data-tracex-ignore or data-tracex-mask.
  • SPA Navigation Tracking: Automatically records route transition breadcrumbs by intercepting history.pushState, history.replaceState, popstate, and hashchange.
  • Full SSR Safety: Safely initializes during Next.js, Remix, or Vite SSR without throwing when window is undefined.

Installation

bun add @tracex-dev/react
# or
npm install @tracex-dev/react

Quickstart

1. Root Initialization

import React from 'react';
import ReactDOM from 'react-dom/client';
import { TraceX, TraceXProvider, TraceXErrorBoundary } from '@tracex-dev/react';

// Initialize the global React client singleton
TraceX.init({
  projectKey: 'tracex_live_react_app_0123456789',
  endpoint: 'https://tracex-edge-ingest.kareemadel10110.workers.dev/api/v1/crashes',
  environment: 'production',
  instrumentClicks: true,
  instrumentNavigation: true,
  instrumentErrors: true,
});

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <TraceXProvider>
      <TraceXErrorBoundary
        fallback={({ error, reset, eventId }) => (
          <div role="alert" className="error-card">
            <h2>Application Error</h2>
            <p>{error.message}</p>
            {eventId && <p>Reference ID: {eventId}</p>}
            <button onClick={reset}>Try again</button>
          </div>
        )}
      >
        <App />
      </TraceXErrorBoundary>
    </TraceXProvider>
  </React.StrictMode>
);

Component & Hook Reference

<TraceXErrorBoundary>

Catches exceptions thrown anywhere in its child component tree.

<TraceXErrorBoundary
  fallback={({ error, reset, eventId }) => <CustomErrorCard error={error} onRetry={reset} refId={eventId} />}
  onError={(error, errorInfo) => console.log('Component stack:', errorInfo.componentStack)}
  onReset={() => console.log('Boundary reset')}
  resetKeys={[activeTabId]} // Automatically resets boundary when keys change
>
  <ProductFeed />
</TraceXErrorBoundary>

withTraceXErrorBoundary HOC

import { withTraceXErrorBoundary } from '@tracex-dev/react';

const ProtectedProfile = withTraceXErrorBoundary(UserProfile, {
  fallback: <div>Failed to load profile.</div>,
});

React Hooks

import { useTraceX, useCaptureException, useAddBreadcrumb } from '@tracex-dev/react';

export function CheckoutButton() {
  const captureException = useCaptureException();
  const addBreadcrumb = useAddBreadcrumb();

  const handleCheckout = async () => {
    addBreadcrumb({ category: 'cart', action: 'checkout_click', target: 'order_btn' });
    try {
      await processOrder();
    } catch (err) {
      captureException(err, { step: 'checkout_step_1' });
    }
  };

  return <button onClick={handleCheckout}>Pay Now</button>;
}

DOM Privacy & Sensitivity Suppression

TraceX never logs sensitive inputs. You can control click breadcrumb capture using data attributes:

  • Automatic Suppression: Clicks on input[type="password"] and input[type="email"] are automatically ignored.
  • data-tracex-ignore: Completely ignores click events on the tagged element and all its children.
  • data-tracex-mask: Completely suppresses click breadcrumbs for the target element.
<!-- Ignored completely in breadcrumbs -->
<button data-tracex-ignore>Secret Admin Action</button>

Configuration Options (TraceXReactOptions)

| Option | Type | Default | Description | |---|---|---|---| | projectKey | string | Required | Project key starting with tracex_live_ or tracex_test_. | | endpoint | string | Edge Gateway | Telemetry ingestion gateway URL. | | environment | string | 'development' | Active deployment stage. | | instrumentClicks | boolean | true | Automatically track user DOM clicks as breadcrumbs. | | instrumentNavigation | boolean | true | Automatically record client SPA history transitions. | | instrumentErrors | boolean | true | Hook window.onerror and window.unhandledrejection. |


License

MIT © 2026 TraceX Platform Team.