getSnapshotBeforeUpdate
is a lifecycle hook that was introduced with React 16.3. It is invoked right before the most recently rendered output is committed and the value returned by it will be passed as a third parameter to componentDidUpdate
. It enables your component to capture current values for example a scroll position before they are potentially changed.
code sandbox is not loading
code sandbox is not loading
Hey rishi, might have been a temporary issue. It's working for me now. Can you check again?
Hi :) Is there any way to implement the same logic with Hooks?