Disallow use this.props in methods with the props argument

October 23, 2019 ยท View on GitHub

Rule Details

Examples of incorrect code for this rule

class Foo extends RX.Component {
  componentDidUpdate(props) {
    const id = this.props.id;
    const { userId } = this.props;
  }
}

Examples of correct code for this rule

class Foo extends RX.Component {
  componentDidUpdate(props) {
    const prevProps = this.props;
    const id = prevProps.id;
    const { userId } = prevProps;
    const currentId = props.id;
  }
}