Replies: 1 comment
|
removeListener doesn’t trigger the callback. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The registerUpdateListener function returns a function that can be used to unregister the listener.
However, it appears that the listener's callback is executed as part of that unregister process, making it difficult to prevent the callback from running during component unmount.
For example, in the following case, calling removeListener ends up executing hogehoge().
What would be the recommended or best practice to handle this situation and avoid triggering the callback on unmount?
All reactions