You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
600 B
29 lines
600 B
// After
|
|
class ExampleComponent extends React.Component {
|
|
// Initialize state in constructor,
|
|
// Or with a property initializer.
|
|
// highlight-next-line
|
|
state = {};
|
|
|
|
// highlight-next-line
|
|
static getDerivedStateFromProps(
|
|
nextProps,
|
|
prevState
|
|
) {
|
|
// highlight-range{1-11}
|
|
if (
|
|
nextProps.currentRow !==
|
|
prevState.lastRow
|
|
) {
|
|
return {
|
|
lastRow: nextProps.currentRow,
|
|
isScrollingDown:
|
|
nextProps.currentRow >
|
|
prevState.lastRow,
|
|
};
|
|
}
|
|
|
|
// Return null to indicate no change to state.
|
|
return null;
|
|
}
|
|
}
|
|
|