Skip to content

no-unused-prop-types: support shouldComponentUpdate nextProps #1213

Closed
@xareelee

Description

type LoginMsgContainerProps = {
  getMsgCodeErrorMsg?: string,
};

class LoginMsgContainer extends React.Component {

  props: LoginMsgContainerProps;

  shouldComponentUpdate(props: LoginMsgContainerProps) {
    if (props.getMsgCodeErrorMsg && props.getMsgCodeErrorMsg.length > 0) {
      this.toast.show(props.getMsgCodeErrorMsg);
    }
  }

  ...
}

I only use prop getMsgCodeErrorMsg in the method shouldComponentUpdate, but the linter raises a react/no-unused-prop-types error (false positive).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions