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

react-wire-persisted

v3.1.0

Published

> Persisted storage for [React Wire](https://github.com/forminator/react-wire)

Downloads

370

Readme

Persisted React Wire

Persisted storage for React Wire

Install

$ pnpm add @forminator/react-wire react-wire-persisted

Usage

// constants.ts
import { key, getPrefixedKeys } from 'react-wire-persisted/lib/utils'

export const NS = 'myapp'

key('foo')

const prefixedKeys = getPrefixedKeys(NS)

export { prefixedKeys as keys }
// index.tsx
import { NS } from './constants'
import * as rwp from 'react-wire-persisted'

rwp.setNamespace(NS)

rwp.setOptions({
    logging: {
        enabled: true,
    },
    storageProvider: rwp.MemoryStorageProvider,
})

// Normal React init code
// store.ts
import { createPersistedWire } from 'react-wire-persisted'
import { keys } from './constants'

type User = {
    id: number
    email: string
}

export const user = createPersistedWire<User | null>(keys.foo, null)
// SomeComponent.tsx
import { useWireState } from '@forminator/react-wire'
import * as store from './store'

const SomeComponent = () => {
    const [user, setUser] = useWireState(store.user)
    return (
        <div>
            <p>User: {user?.email}</p>
            <button onClick={() => setUser({ ...user, email: '[email protected]'})}>
                Change Email
            </button>
        </div>
    )
}

export default SomeComponent

See the demo folder for a more complete example.

Storage Providers

By default, this library uses localStorage via LocalStorageProvider in browser environments. However, you can customize the storage behavior using setOptions:

import { setOptions, createPersistedWire } from 'react-wire-persisted'
import { MemoryStorageProvider } from 'react-wire-persisted'

// Use in-memory storage (useful for testing or SSR)
setOptions({
    storageProvider: MemoryStorageProvider,
})

This is useful for:

  • Testing: Avoid localStorage in unit tests
  • SSR: Use in-memory storage during server-side rendering
  • Custom storage: Implement your own provider by extending RWPStorageProvider

See LocalStorageProvider and MemoryStorageProvider for implementation examples.

API

createPersistedWire<T = null>(key: string, value?: T): PersistedWire<T>

Creates a persisted Wire that automatically syncs with the configured storage provider.

setNamespace(namespace: string): void

Sets the namespace for storage keys. This prefixes all keys to avoid collisions.

setOptions(options: Partial<RWPOptions>): void

Configure library options:

  • logging.enabled: Enable/disable logging (default: false)
  • storageProvider: Custom storage provider class

getOptions(): RWPOptions

Get current options.

getNamespace(): string | null

Get current namespace.

getStorage(): RWPStorageProvider

Get the current storage provider instance.

upgradeStorage(): boolean

Attempts to upgrade from fake storage (used during SSR) to real localStorage. Returns true if upgrade was successful. Call this after hydration in client-side code.

Building

$ pnpm build

Contributing

Contributions are welcome. Please feel free to submit a GitHub Issue or pull request.

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Run linter
pnpm lint

Publishing

To publish a new version to npm:

# Build the project
pnpm build

# Bump version (choose one)
npm version patch  # bug fixes (e.g., 2.1.0 -> 2.1.1)
npm version minor  # new features (e.g., 2.1.0 -> 2.2.0)
npm version major  # breaking changes (e.g., 2.1.0 -> 3.0.0)

# Push changes and tags
git push
git push --tags

# Publish to npm
npm publish

Miscellaneous

For generating some sample data:

import nickGenerator from 'nick-generator'

export const categories = [
    'Entrepeneurs',
    'Investors',
    'Superheroes',
    'Engineers',
    'Chefs',
    'Performers',
    'Musicians',
].reduce((acc, it, i) => [
    ...acc,
    {
        id: (i + 1),
        name: it,
    }
], [])

export const people = Object.values(categories).map(category => {
    
    return Array(8).fill(null).map((_, i) => {
        
        const [firstName, lastName] = nickGenerator().split(' ')
        
        return {
            id: (i + 1),
            categoryId: category.id,
            firstName,
            lastName,
        }
        
    })
    
}).flat()