At the risk of sounding like a broken record, IMHO lifecycle event handlers should be focused entirely on the internals of a component: setting things up and tearing things down. If there is some fluctuating data source outside the component, subscribe to it and react to changes in it when those changes happen. Don’t involve lifecycle events in that calculation. I would write this like so.