const state = proxy({dur: 4,count: 1});const incDur = () => {++state.dur};const decDur = () => {--state.dur};const incCount = () => {++state.count;setTimeout(incCount, 100 * state.dur);};incCount();const snap = useSnapshot(state)return (<div><h3>{snap.dur}</h3><buttondisabled={snap.dur <= 1}onClick={decDur}>-</button><buttondisabled={snap.dur >= 10}onClick={incDur}>+</button></div>);
Proxy state made simple
Proxy state made simple