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

@dotdo/react

v1.0.0

Published

React hooks and components for dotdo Durable Objects - real-time sync, live queries, and admin UI

Downloads

1,153

Readme

@dotdo/react

React bindings for dotdo Durable Objects with real-time data synchronization.

Installation

npm install @dotdo/react @dotdo/client
# or
pnpm add @dotdo/react @dotdo/client

Peer dependencies: react >=18.0.0, zod >=3.0.0 (optional, for schema validation)

Quick Start

Wrap your app with the DO provider and use hooks to access real-time data:

import { DOProvider, useCollection } from '@dotdo/react'

function App() {
  return (
    <DOProvider url="wss://api.example.com.ai/ws">
      <TaskList />
    </DOProvider>
  )
}

function TaskList() {
  const { data: tasks, create, update } = useCollection('tasks')

  return (
    <ul>
      {tasks.map(task => (
        <li key={task.id} onClick={() => update(task.id, { done: !task.done })}>
          {task.title}
        </li>
      ))}
      <button onClick={() => create({ title: 'New task', done: false })}>
        Add Task
      </button>
    </ul>
  )
}

API Reference

Hooks

| Hook | Description | |------|-------------| | useCollection(name) | Subscribe to a collection with CRUD operations and optimistic updates | | useRecord(collection, id) | Subscribe to a single record by ID | | useLiveQuery(query) | Execute a live query with automatic re-subscription on changes | | useDO(namespace?) | Access the underlying Durable Object client | | use$() | Access the workflow context for event handling and scheduling | | useConnectionState() | Monitor WebSocket connection status |

useCollection

const { data, create, update, remove, loading, error } = useCollection('users')

Returns real-time data with optimistic updates. Mutations are applied immediately and rolled back on failure.

useRecord

const { data: user, update, remove, loading } = useRecord('users', userId)

Subscribe to a single record. Returns null if the record doesn't exist.

useLiveQuery

const { data, refetch } = useLiveQuery({
  collection: 'orders',
  where: { status: 'pending' },
  orderBy: { createdAt: 'desc' },
  limit: 10
})

useConnectionState

const { connected, reconnecting, error } = useConnectionState()

Entry Points

| Entry Point | Description | |-------------|-------------| | @dotdo/react | Main entry with DOProvider and all hooks | | @dotdo/react/hooks | Hooks only (for custom provider setups) | | @dotdo/react/tanstack | TanStack DB integration with CollectionOptions factory | | @dotdo/react/admin | Admin data provider (React Admin-inspired pattern) |

TanStack DB Integration

import { CollectionOptions } from '@dotdo/react/tanstack'

const usersCollection = CollectionOptions('users', {
  schema: userSchema, // optional zod schema
})

Admin Data Provider

import { createDataProvider } from '@dotdo/react/admin'

const dataProvider = createDataProvider({
  url: 'wss://api.example.com.ai/ws',
})

Related Packages

License

MIT