A word about React's getSnapshotBeforeUpdate
.
It's only useful in a very specific situation.
When there's something to measure in the DOM before the measured thing is re-rendered inside the render
method of a Component
and adjusted again inside componentDidUpdate
afterwards. In other cases, componentDidUpdate
is enough.
It seems to me that getSnapshotBeforeUpdate
is already a legacy method in React. And it just barely came out.