What happens if you call this.setState() unconditionally in componentDidUpdate()?
Calling this.setState() unconditionally in componentDidUpdate() causes an infinite update loop. When setState is called, it triggers the component's update lifecycle again, which will execute componentDidUpdate again, where setState gets called again, and so on. Always wrap setState calls in componentDidUpdate with a condition that checks if the relevant props or state have actually changed to avoid this issue.