What is the purpose of `getSnapshotBeforeUpdate()` lifecycle method?
The new getSnapshotBeforeUpdate() lifecycle method is called right before DOM updates. The return value from this method will be passed as the third parameter to componentDidUpdate().
class MyComponent extends React.Component {getSnapshotBeforeUpdate(prevProps, prevState) {// ...}}
This lifecycle method along with componentDidUpdate() covers all the use cases of componentWillUpdate().
January 16, 2022
446
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS