From 5775f070e211a09498dd2f5da7278ce0848eaf2f Mon Sep 17 00:00:00 2001 From: Andre Wiggins <459878+andrewiggins@users.noreply.github.com> Date: Tue, 3 Jul 2018 12:17:29 -0500 Subject: [PATCH] Add signature to getSnapshotBeforeUpdate section (#1032) Add the signature for `getSnapshotBeforeUpdate` to its section, just like all other lifecycle method sections have. --- content/docs/reference-react-component.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/docs/reference-react-component.md b/content/docs/reference-react-component.md index 26005e58..3b0c67af 100644 --- a/content/docs/reference-react-component.md +++ b/content/docs/reference-react-component.md @@ -293,6 +293,10 @@ Note that this method is fired on *every* render, regardless of the cause. This ### `getSnapshotBeforeUpdate()` +```javascript +getSnapshotBeforeUpdate(prevProps, prevState) +``` + `getSnapshotBeforeUpdate()` is invoked right before the most recently rendered output is committed to e.g. the DOM. It enables your component to capture some information from the DOM (e.g. scroll position) before it is potentially changed. Any value returned by this lifecycle will be passed as a parameter to `componentDidUpdate()`. This use case is not common, but it may occur in UIs like a chat thread that need to handle scroll position in a special way.