Closed Aman035 closed 3 years ago
Currently, the state is managed in components itself. This will add redundancy in case of reuse of components. A better approach will be to have the state management by using mobx.
const [pin,setPin] = useState(''); const pushPin = async(val)=>{ if(pin.length <4) setPin(pin + val); } const popPin = ()=>{ if(pin.length>0) setPin(pin.slice(0, -1)); }
Currently, the state is managed in components itself. This will add redundancy in case of reuse of components. A better approach will be to have the state management by using mobx.