useEffect(() => {
const onFocus = () => console.log('focus On');
if (typeof window !== 'undefined' && window.addEventListener) {
window.addEventListener('focus', onFocus, false);
}
return () => {
window.removeEventListener('focus', onFocus);
};
}, [])