<gh_stars>1-10
{"pathContext":{"action":"https://codepen.io/pen/define","payload":"{\"editors\":\"0010\",\"html\":\"<div id=\\\"root\\\"></div>\",\"js\":\"// After\\nclass ExampleComponent extends React.Component {\\n  // Initialize state in constructor,\\n  // Or with a property initializer.\\n  // highlight-range{1-4}\\n  state = {\\n    isScrollingDown: false,\\n    lastRow: null,\\n  };\\n\\n  // highlight-range{1-7}\\n  static getDerivedStateFromProps(props, state) {\\n    if (props.currentRow !== state.lastRow) {\\n      return {\\n        isScrollingDown: props.currentRow > state.lastRow,\\n        lastRow: props.currentRow,\\n      };\\n    }\\n\\n    // Return null to indicate no change to state.\\n    return null;\\n  }\\n}\\n\",\"js_external\":\"//unpkg.com/react/umd/react.development.js;//unpkg.com/react-dom/umd/react-dom.development.js\",\"js_pre_processor\":\"babel\",\"layout\":\"left\"}"}}