How can you test if a component's unmounting cleanup works correctly?
You can test unmounting behavior using testing libraries. React Testing Library provides an unmount() function that simulates component unmounting. After calling this function, you can verify that cleanup has occurred correctly, such as checking if timers were cleared or listeners removed. This allows automated testing of unmounting behavior.