Skip to content

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

Closed
@xareelee

Description

@xareelee
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).

Metadata

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