Based on the code from GitHub:
A problem is that the hook isn't reusable with document.onfullscreenchange which is overwritten everytime the hook is called.
document.onfullscreenchange
Mounting it to the elRef is better so you have have multiple instances.:
useLayoutEffect(() => { if (elRef.current != null) { const refEl = elRef.current; refEl.onfullscreenchange = () => setIsFullscreen(document[getBrowserFullscreenElementProp()] != null); return () => (refEl.onfullscreenchange = undefined); } });
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Based on the code from GitHub:
A problem is that the hook isn't reusable with
document.onfullscreenchange
which is overwritten everytime the hook is called.Mounting it to the elRef is better so you have have multiple instances.: