Method 2: getSnapshotBeforeUpdate Extension in Detail

This lesson is an extension of the previous lesson. We'll discuss getSnapshotBeforeUpdate components and the chat panel in more detail.

The componentDidUpdate Lifecycle Method

The getSnapshotBeforeUpdate lifecycle method doesn’t work on its own. It is meant to be used in conjunction with the componentDidUpdate lifecycle method.

Whatever value is returned from the getSnapshotBeforeUpdate lifecycle method is passed as the third argument to the componentDidUpdate method. Let’s call the returned value from getSnapshotBeforeUpdate, snapshot. Here’s what we get:

Get hands-on with 1200+ tech skills courses.