no-is-mounted.md 810 B

Prevent usage of isMounted (react/no-is-mounted)

isMounted is an anti-pattern, is not available when using ES6 classes, and it is on its way to being officially deprecated.

Rule Details

The following patterns are considered warnings:

var Hello = createReactClass({
  handleClick: function() {
    setTimeout(function() {
      if (this.isMounted()) {
        return;
      }
    });
  },
  render: function() {
    return <div onClick={this.handleClick.bind(this)}>Hello</div>;
  }
});

The following patterns are not considered warnings:

var Hello = createReactClass({
  render: function() {
    return <div onClick={this.props.handleClick}>Hello</div>;
  }
});