I just started to studying React.
When learning LifeCycle and I wonder about componentDidUpdate
method.
As I read componentDidUpdate
method can have three params (prevProps, prevState, snapshot
). If I can find out prevState
from componentDidUpdate
what is the snapshot
for?
It may not important but I just got curious
From the
componentDidUpdate
docs:getSnapshotBeforeUpdate
Use-cases appear mostly related to querying the DOM, or anything that can't be derived from
state
orprops
.