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

dreaction-react

v1.1.0

Published

DReaction client for React web applications

Readme

DReaction React

DReaction client library for React web applications with plugin support for debugging and monitoring.

Installation

npm install dreaction-react
# or
yarn add dreaction-react
# or
pnpm add dreaction-react

Quick Start

import { dreaction } from 'dreaction-react';

// Configure and enable plugins
dreaction
  .configure({
    host: 'localhost',
    port: 9600,
    name: 'My React App',
  })
  .useReact() // Enable all plugins
  .connect();  // Connect to DReaction server

Usage with ConfigPanel

For a better user experience, you can use the built-in ConfigPanel component:

import { ConfigPanel } from 'dreaction-react';

function App() {
  return (
    <div>
      <YourApp />
      <ConfigPanel />
    </div>
  );
}

Auto-Reconnect Feature

The ConfigPanel automatically remembers your connection settings and status. When you refresh the page:

  • Host and Port settings are saved to localStorage
  • Connection state is remembered
  • If you were connected before refresh, it will automatically reconnect

This means you only need to configure and connect once, and all future page loads will automatically restore your connection!

Important: Make sure to call .useReact() to enable plugins before connecting:

// In your initialization file (e.g., utils/dreaction.ts)
import { dreaction } from 'dreaction-react';

dreaction
  .configure({
    info: {
      appName: 'My App',
    },
  })
  .useReact(); // This is required to enable plugins!

export { dreaction };

Plugins

DReaction React comes with built-in plugins for debugging:

1. Networking Plugin

Intercepts and monitors network requests (fetch and XMLHttpRequest).

2. localStorage Plugin

Tracks all localStorage operations (setItem, removeItem, clear).

3. Console Logs Plugin

Captures console.log, console.warn, console.debug, and console.info calls.

4. Global Errors Plugin

Catches unhandled errors and promise rejections.

Plugin Configuration

You can customize plugin behavior:

dreaction.useReact({
  // Enable/disable error tracking
  errors: true, // or provide options: { veto: (frame) => boolean }
  
  // Enable/disable console logging
  log: true,
  
  // Configure localStorage monitoring
  localStorage: {
    ignore: ['SOME_KEY_TO_IGNORE'] // Keys to ignore
  },
  
  // Configure network monitoring
  networking: {
    ignoreUrls: /analytics|tracking/, // URLs to ignore
    ignoreContentTypes: /image/, // Content types to ignore
  }
});

Disable Specific Plugins

dreaction.useReact({
  errors: false,      // Disable error tracking
  log: false,         // Disable console logging
  localStorage: false, // Disable localStorage monitoring
  networking: false,  // Disable network monitoring
});

Data Watchers

Monitor React state in real-time:

import { dreaction } from 'dreaction-react';

// Register a data watcher
export const { useDebugDataWatch: useDebugCounter } = 
  dreaction.registerDataWatcher('counter', 'text');

// Use in your component
function Counter() {
  const [count, setCount] = useState(0);
  
  // This will send updates to DReaction server
  useDebugCounter(count);
  
  return <div>Count: {count}</div>;
}

Data Watch Types

  • 'text' - Display as text
  • 'json' - Display as formatted JSON
  • 'list' - Display as a list

Custom Commands

Register custom commands that can be triggered from the DReaction app:

dreaction.registerCustomCommand({
  title: 'Clear Cache',
  command: 'clearCache',
  description: 'Clear application cache',
  handler: async () => {
    localStorage.clear();
    return 'Cache cleared successfully';
  }
});

// Commands with arguments
dreaction.registerCustomCommand({
  title: 'Set User',
  command: 'setUser',
  description: 'Set current user',
  args: [
    {
      name: 'userId',
      type: 'string',
    }
  ],
  handler: async (args) => {
    console.log('Setting user:', args.userId);
    return `User set to: ${args.userId}`;
  }
});

API Reference

dreaction.useReact(options?)

Enable React plugins with optional configuration.

Parameters:

  • options.errors - Error tracking options or boolean
  • options.log - Enable console logging (boolean)
  • options.localStorage - localStorage monitoring options or boolean
  • options.networking - Network monitoring options or boolean

Returns: dreaction instance (chainable)

dreaction.configure(options)

Configure DReaction client settings.

Parameters:

  • options.host - Server host (default: 'localhost')
  • options.port - Server port (default: 9600)
  • options.name - Application name
  • options.info - Additional info object

Returns: dreaction instance (chainable)

dreaction.connect()

Connect to DReaction server and activate all plugins.

Returns: dreaction instance (chainable)

dreaction.close()

Disconnect from server and deactivate plugins.

Returns: dreaction instance (chainable)

dreaction.registerDataWatcher(name, type, options?)

Register a data watcher for monitoring React state.

Parameters:

  • name - Watcher identifier
  • type - Display type ('text' | 'json' | 'list')
  • options.enabled - Enable/disable watcher (default: true in development)

Returns: Object with useDebugDataWatch hook

dreaction.registerCustomCommand(config)

Register a custom command.

Parameters:

  • config.title - Command title
  • config.command - Command identifier
  • config.description - Command description
  • config.args - Array of argument definitions
  • config.handler - Command handler function

Returns: Unregister function

Example

Check out the complete example in example/nextjs/ directory.

License

MIT