1. Purpose
– Reload data on focus tab change on browser
2. Data load request
– func.getSpecialReservation(setReservationRows)
– reload when counter changes
useEffect(() => { // Server request func.getSpecialReservation(setReservationRows); }, [router.query.counter]);
3. Setting the function outside the component
– addEventListener
(function () { window.addEventListener('focus', () => { SpecialDialogFunc (); }); })();
4. Setting the function inside the component
– add function
const SpecialDialogFunc = () => { func.getSpecialReservation(setReservationRows); } window.SpecialDialogFunc = SpecialDialogFunc ;