Does useBeforeUnload
have a condition to remove the listener?
#11439
Unanswered
alexandre-boily
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From the mdn web doc usage, it seems like constantly having a listener on
beforeunload
impacts performance.From my understanding of the code, we don't really have a condition to remove the listener if it can not be used. Is this an oversight, or did I misunderstand it?
Example on how
react-beforeunload
handles it : https://github.com/jacobbuck/react-beforeunload/blob/a271f7a01f9fd5309d9f859f5e805c9c3c8ba28c/src/useBeforeunload.js#L10Beta Was this translation helpful? Give feedback.
All reactions