You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A React hook counter with min/max/step/cast options
Quick Start
importuseCounterfrom'@react-hook/counter'constComponent=()=>{constcounter=useCounter(5/*initialValue*/,{min: 0,max: 10,// Sets the value to the maximum value when// the min value threshold has been crossedonMin: (set)=>set(10),// Sets the value to the minimum value when// the max value threshold has been crossedonMax: (set)=>set(0),})return(<div><div>Value: {counter.value}</div><div><buttononClick={()=>counter.decr()}>-</button>{' / '}<buttononClick={()=>counter.incr()}>+</button></div></div>)}