What is a common pattern to prevent state updates on unmounted components?
A common pattern is to use a boolean flag (often named 'isMounted') to track if the component is still mounted. This flag is set to true when the component mounts and false when it unmounts. Before updating state in async callbacks, the code checks this flag and only proceeds if the component is still mounted, preventing updates on unmounted components.