React Alert on Close is a simpler helper function that will work on ReactJS projects. (TS application is a Work in progress).
In your .js or .jsx file, you can simply add the following piece of code.
import AlertOnClose from "react-alert-on-close";
//other imports
...
useEffect(()=>{
//other side-effects
...
AlertOnClose();
},[])
//other code
...
npm install react-alert-on-close
or
yarn add react-alert-on-close