Skip to main content

Cotton Box

Minimal state management library for React and beyond.

Features

Lightweight & Fast

Works for simple PWAs, complex applications, and even time-critical games.

No Providers or Boilerplate

Share states across different React render trees without providers or tedious setups.

Customizable Equality Checking

Minimize unnecessary re-renders even when selector returns new object on each render.

Declarative Lifecycle Management

Persist state with init, didSet, and didReset lifecycle hooks.

Works With and Without React

React bindings exists as a separate package but still, with first-class integration.

Fully Typed API

Complete type definitions, detailed descriptions, and rich examples — all included.

Temporarily Unwatch State in Hooks

Temporarily unsubscribe from state changes to prevent components from re-rendering.

Async State Updates

For unique cases that really require it.