UNPKG

valtio-reactive

Version:

valtio-reactive makes Valtio a reactive library

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