componentDidUpdate is called after any rendered HTML has finished loading. It receives two arguments, the props and state of the component before the current updating period began.
Is componentDidUpdate called after every render?
3 Answers. The componentDidUpdate method is called after the render method of the component is done executing. That means that it will be called after all children's render methods have finished.
Why does componentDidUpdate keep getting called?
ComponentDidUpdate is an update LifeCycle Hook, this will get triggered when there is something is changed in the component State or Props. Coming to your code: You are calling a handler showPosts to setState, that will again trigger the update lifecycle. This will lead to an infinite loop.