mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-25 05:03:07 +00:00
17 lines
355 B
JavaScript
17 lines
355 B
JavaScript
// Before
|
|
class ExampleComponent extends React.Component {
|
|
state = {
|
|
isScrollingDown: false,
|
|
};
|
|
|
|
// highlight-range{1-8}
|
|
componentWillReceiveProps(nextProps) {
|
|
if (this.props.currentRow !== nextProps.currentRow) {
|
|
this.setState({
|
|
isScrollingDown:
|
|
nextProps.currentRow > this.props.currentRow,
|
|
});
|
|
}
|
|
}
|
|
}
|