3

在我的反应项目中使用 FixedDataTable 并惊讶地看到以下警告:

warning.js:36 Warning: FixedDataTable: isMounted is deprecated. Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks.

我所理解的是 isMounted 被视为一个反模式链接,所以我很惊讶在实际源代码中看到它。我在这里错过了什么吗?

  _didScrollStop: function _didScrollStop() {
    if (this.isMounted() && this._isScrolling) {
      this._isScrolling = false;
      this.setState({ redraw: true });
      if (this.props.onScrollEnd) {
        this.props.onScrollEnd(this.state.scrollX, this.state.scrollY);
      }
    }
  }
4

0 回答 0