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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@instant3p/react-offline

v0.20.12012

Published

3rd party React hooks for Instant with offline-first capabilities

Readme

3rd party offline-first React hooks for Instant.

@instant3p/react-offline

3rd party React hooks with offline-first capabilities. This package provides React hooks powered by @instant3p/core-offline for seamless offline-first functionality.

Key Features

  • 🔌 Offline-First: Works 100% offline with local storage
  • 🔄 Seamless Sync: Automatically syncs when connectivity returns
  • Familiar API: React hooks inspired by Instant's patterns
  • 🌐 Dynamic Connectivity: Switch between online/offline modes at runtime

Installation

npm install @instant3p/react-offline

Quick Start

import { init, tx, id } from '@instant3p/react-offline';

const APP_ID = 'your-app-id';

const db = init({ 
  appId: APP_ID,
  isOnline: false // Start in offline mode
});

function App() {
  const { isLoading, error, data } = db.useQuery({ 
    users: {} 
  });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <div>
      <h1>Users ({data.users.length})</h1>
      {data.users.map(user => (
        <div key={user.id}>{user.name}</div>
      ))}
      
      <button onClick={() => {
        const userId = id();
        db.transact(
          db.tx.users[userId].update({ name: 'New User' })
        );
      }}>
        Add User (Works Offline!)
      </button>
      
      <button onClick={() => db.setOnline(true)}>
        Go Online
      </button>
      
      <button onClick={() => db.setOnline(false)}>
        Go Offline
      </button>
    </div>
  );
}

Documentation

This package provides React hooks with offline capabilities. The hooks work with cached data:

  • useQuery - Query your data with real-time subscriptions
  • useAuth - Handle authentication state
  • useConnectionStatus - Monitor connectivity

The main difference is the enhanced init function that supports:

const db = init({
  appId: 'your-app-id',
  schema: yourSchema,
  isOnline: false, // Start offline
});

// Switch modes at runtime
db.setOnline(true);  // Go online
db.setOnline(false); // Go offline

For more details on usage patterns, see the examples above.

Development

This package is built on top of @instant3p/core-offline which provides the offline-first functionality. It's a 3rd party fork with enhanced offline capabilities.