Class components and migration

getSnapshotBeforeUpdate

Capture pre-commit DOM information and pass it to componentDidUpdate as its third argument.

Formal Syntax & Structure

react syntaxreact
getSnapshotBeforeUpdate() { return this.list.current.scrollHeight; }

Working Example

Example Snippetreact
getSnapshotBeforeUpdate() { return this.list.current.scrollHeight; }
React Reference