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

@realtimejs/react

v0.1.2

Published

Official React hooks (useChat, usePresence) and UI primitives.

Readme

@realtimejs/react

The official React SDK for RealtimeJS.

RealtimeJS TypeScript License

@realtimejs/react provides a suite of highly optimized, production-ready React Hooks and context providers for building realtime interfaces instantly.

It wraps the @realtimejs/core engine with an Optimistic UI architecture, ensuring that user interactions feel zero-latency while transparently handling network sync, offline queueing, and state management in the background.

Features

  • ⚡️ Optimistic UI & Mutation Queue: Messages instantly appear in the UI. Offline actions (edits, deletes) are safely queued and synced upon reconnection.
  • 🔄 Re-render Optimized (Zero-Latency): Heavy use of useCallback and useMemo combined with Context-state-hoisting prevents React waterfall renders.
  • 🧠 Context-Driven Architecture: Inject custom inputs, headers, or messages instantly using useChatContext() without prop-drilling.
  • ⚙️ Dynamic UI Configuration: Expose a user settings dashboard effortlessly using UIConfigProvider and the updateConfig dispatcher.
  • ♿️ Accessible by Default: All included components are ARIA-compliant (live regions, interactive roles).

Installation

npm install @realtimejs/react @realtimejs/core

(You will also need a transport adapter, e.g., @realtimejs/adapter-socketio)

Quick Start

1. Setup the Provider

Wrap your application (or specific route) in the RealtimeProvider.

import { RealtimeProvider } from '@realtimejs/react';
import { createRealtime } from '@realtimejs/core';
import { createSocketIOAdapter } from '@realtimejs/adapter-socketio';

const client = createRealtime({ 
  transport: createSocketIOAdapter('http://localhost:3000') 
});

export function App() {
  return (
    <RealtimeProvider client={client}>
      <ChatInterface />
    </RealtimeProvider>
  );
}

2. Using the Hooks

import { useChatContext } from '@realtimejs/react';

function CustomChatInterface() {
  // Access memoized state and methods directly from the Provider!
  const { messages, sendMessage } = useChatContext();

  return (
    <div>
      {messages.map(msg => (
        <div key={msg.id}>{msg.content} - {msg.status}</div>
      ))}
      <button onClick={() => sendMessage("Hello!")}>Send</button>
    </div>
  );
}

3. Using the Drop-in UI Components

import { Chat, ChatProvider } from '@realtimejs/react';

function QuickChat() {
  return (
    <ChatProvider roomId="room-1" userId="user-123">
      <Chat 
        roomId="room-1" 
        userId="user-123" 
        // Easily override internal UI elements:
        // components={{ MessageItem: CustomMessage }}
      />
    </ChatProvider>
  );
}

Available Hooks

  • useRealtime() - Access the raw core engine.
  • useChatContext() - Access hoisted messaging, typing, and room states safely inside a ChatProvider.
  • usePresence() - User online/offline mapping.
  • useUIConfig() - Access and dispatch global Settings (like read receipts or pagination limits).
  • useChat(roomId, userId) - Low-level messaging hook (used internally by ChatProvider).
  • useTyping(roomId, userId) - Low-level typing indicator tracking (used internally by ChatProvider).

License

MIT License. See the repository root for details.