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.
We'll cover the following
componentDidUpdate Lifecycle Method
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
Let’s call the returned value from
getSnapshotBeforeUpdate, snapshot. Here’s what we get: