CRED-CLUB / neopop-web

NeoPOP components library based on CRED's design system
https://playground.cred.club
Apache License 2.0
958 stars 146 forks source link

fix: code improvements and cleanup #28

Closed shanpriyan closed 2 years ago

shanpriyan commented 2 years ago
  1. Added cleanup for setTimeout in useEffect.
  2. Removed the useEffect which will be triggered based on the removeId state which will further call the removeToast and invoked the removeToast directly inside the setTimeout.
  3. Code improvements
    - if (!toastList) return null;
    - if (toastList && !toastList.length) return null;
    + if (!toastList?.length) return null;

    will return null for both falsy values(null,undefined) and empty array [ ]

shanpriyan commented 2 years ago

@mittalchirag