Aman035 / wallet-ui-react

MIT License
8 stars 1 forks source link

Adding mobx for state management #2

Closed Aman035 closed 3 years ago

Aman035 commented 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));
    }