Anthony Oyathelemhi
Dev Notes by Tony

Dev Notes by Tony

Add Auto-logout To A React App

Nov 14, 20212 min read

TL;DR const logoutTimerIdRef = useRef(null); useEffect(() => { const autoLogout = () => { if (document.visibilityState === 'hidden') { const timeOutId = window.setTimeout(logoutUser, 5 * 60 * 1000); logoutTimerIdRef.current = timeO...

Add Auto-logout To A React App
The Basics: JavaScript Addition Operator (+)
The Little Known CSS Unit