UNPKG

react-unprop

Version:

A lightweight React signal system for sharing reactive state across components — no prop drilling, no context, no global state libraries. Just pure reactivity with persistent storage.

18 lines (16 loc) 488 B
type Callback = () => void; interface SignalOptions<T> { persistKey?: string; encrypted?: boolean; secret?: string; } declare function createSignal<T>(initialValue: T, options?: SignalOptions<T>): { get: () => T; set: (next: T | ((prev: T) => T)) => void; subscribe: (cb: Callback) => () => boolean | undefined; }; declare function useSignal<T>(signal: { get: () => T; subscribe: (cb: () => void) => () => void; }): T; export { createSignal, useSignal };