UNPKG

valtio-reactive

Version:

valtio-reactive makes Valtio a reactive library

10 lines (8 loc) 196 B
import { watch } from './core.js'; export function effect(fn: () => void, cleanup?: () => void): () => void { const unwatch = watch(fn); return () => { unwatch(); cleanup?.(); }; }