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

hank-zilla

v1.2.2

Published

A lightweight React state management library with modular architecture

Downloads

79

Readme

🦖 Hank-Zilla

A lightweight React state management library that eliminates the need for Context, Redux, or Providers. Share state across components as easily as useState with global accessibility.

npm version License: MIT TypeScript

✨ Features

  • 🚀 No Provider Required: Share state globally without wrapping components in Providers
  • 🔄 Drop-in Replacement: Replace useState with useAppState for global state
  • 🎯 Access Anywhere: Use the same state in any component, anywhere in your app
  • 🪶 Lightweight: Zero dependencies, minimal bundle size (~2.1KB)
  • Fast: Built on React's useSyncExternalStore for optimal performance
  • 📦 TypeScript: Full TypeScript support with type inference

📦 Installation

npm install hank-zilla

🚀 Quick Start

import { useAppState, setAppState, getAppState } from 'hank-zilla'

// Parent Component - Set state
function ParentComponent() {
    const user = useAppState('user', { name: '', email: '' })

    return (
        <div>
            <button
                onClick={() => setAppState('user', { name: 'John Doe', email: '[email protected]' })}
            >
                Set User
            </button>
            <ChildComponent />
        </div>
    )
}

// Child Component - Access same state (no props needed!)
function ChildComponent() {
    const user = useAppState('user')

    return <div>{user ? `Welcome, ${user.name}!` : 'No user logged in'}</div>
}

📖 API Reference

useAppState(key, defaultValue?, removeOnUnmount?)

React hook for managing global state - works exactly like useState but globally accessible.

// Basic usage
const count = useAppState('count', 0)

// Auto-cleanup when component unmounts
const tempData = useAppState('tempData', null, true)

// TypeScript support
interface User {
    name: string
    email: string
}
const user = useAppState<User>('user', null)

setAppState(key, value)

Update state from anywhere in your app - works with values or updater functions.

// Set value directly
setAppState('count', 42)

// Update with function (like useState)
setAppState('count', (prev) => prev + 1)

// Update object (shallow merge)
setAppState('user', { name: 'John' })

// Update array
setAppState('items', (prev) => [...prev, 'new item'])

getAppState(key?)

Get state value without subscribing to changes (no re-renders).

// Get specific key
const currentCount = getAppState('count')

// Get all state
const allState = getAppState()

// ⚠️ Note: This doesn't trigger re-renders when state changes

$getAppState (Console Helper)

Debug helper available in browser console to inspect your app state.

// In browser console
$getAppState // Returns all state
$getAppState('key') // Returns specific key

🎯 Advanced Usage

Auto-cleanup with removeOnUnmount

function TemporaryComponent() {
    // This state will be deleted when component unmounts
    const [data, setData] = useAppState('tempData', [], true)

    return <div>Temporary data: {data.length} items</div>
}

TypeScript Support

interface CartItem {
    id: string
    name: string
    price: number
}

// Type inference
const [cart, setCart] = useAppState<CartItem[]>('cart', [])

// Add item with type safety
const addItem = (item: CartItem) => {
    setCart((prev) => [...prev, item])
}

Performance: When to use getAppState

// ✅ Good: Use useAppState for UI components
function Counter() {
    const [count, setCount] = useAppState('count', 0)
    return <div>Count: {count}</div> // Re-renders when count changes
}

// ✅ Good: Use getAppState for utilities/callbacks
function logCurrentState() {
    const count = getAppState('count')
    console.log('Current count:', count) // No re-renders
}

📊 Comparison

| Feature | Hank-Zilla | Context API | Redux | Zustand | | ----------------- | ----------- | ----------------- | ------------------ | ----------- | | Setup | ❌ None | ✅ Provider | ✅ Store + Actions | ✅ Store | | Bundle Size | 🟢 ~1.3KB | 🟢 Built-in | 🔴 ~45KB | 🟡 ~8KB | | Global Access | ✅ Anywhere | ❌ Provider scope | ✅ Anywhere | ✅ Anywhere | | TypeScript | 🟢 Full | 🟡 Manual | 🟢 Full | 🟢 Full |

🔧 Migration

From useState to useAppState

// Before: Local state
const [count, setCount] = useState(0)

// After: Global state
const count = useAppState('count', 0)

From Context API

// Before: Complex setup
const UserContext = createContext()
const { user, setUser } = useContext(UserContext)

// After: Direct usage
const user = useAppState('user', null)

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.

📄 License

MIT License - see the LICENSE file for details.

🙏 Acknowledgments

Built with ❤️ by phamdung2209 • Special thanks to the React team for useSyncExternalStore


Made with 🦖 by the Hank-Zilla team