I recently ran into a memory leak when using this server-side. This occurs because the visibility handlers are set up in the constructor instead of a lifecycle hook, and because componentWillUnmount does not execute server-side, we never stop observing the element. I set up a simple example of this happening here: https://github.com/the83/memory-leak-example
This moves the setup into the componentDidMount hook so that we don't even observe visibility at all server-side.
I recently ran into a memory leak when using this server-side. This occurs because the visibility handlers are set up in the constructor instead of a lifecycle hook, and because
componentWillUnmount
does not execute server-side, we never stop observing the element. I set up a simple example of this happening here: https://github.com/the83/memory-leak-exampleThis moves the setup into the
componentDidMount
hook so that we don't even observe visibility at all server-side.