mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 12:13:11 +00:00
committed by
Dan Abramov
parent
e8cdf5128a
commit
dbe5b49bbf
@@ -295,7 +295,7 @@ If you need to update `state` in response to `props` changes, use [`getDerivedSt
|
||||
|
||||
### `getSnapshotBeforeUpdate()`
|
||||
|
||||
`getSnapshotBeforeUpdate()` is invoked right before the most recently rendered output is committed to e.g. the DOM. It enables your component to capture current values (e.g. scroll position) before they are potential changed. Any value returned by this lifecycle will be passed as a parameter to `componentDidUpdate()`.
|
||||
`getSnapshotBeforeUpdate()` is invoked right before the most recently rendered output is committed to e.g. the DOM. It enables your component to capture current values (e.g. scroll position) before they are potentially changed. Any value returned by this lifecycle will be passed as a parameter to `componentDidUpdate()`.
|
||||
|
||||
For example:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user