Slide 11
Slide 11 text
w $BMMFEBU$PNNJU1IBTF
w 3FUVSOBTOBQTIPU BOZ
CFGPSFVQEBUFUIF)PTU
w UIFTOBQTIPUJTQBTTFEUPDPNQPOFOU%JE6QEBUF
HFU4OBQTIPU#FGPSF6QEBUF
getSnapshotBeforeUpdate() {
return {
scrollHeight: document.body.scrollHeight,
scrollTop: document.body.scrollTop,
};
}
componentDidUpdate(prevProps, prevState, snapshot) {
const {body} = document;
const {scrollTop, scrollHeight} = snapshot;
body.scrollTop = scrollTop + (body.scrollHeight - scrollHeight);
}