Skip to content

react/no-unused-prop-types cannot find props being used inside helper functions #1135

Closed
@renanvalentin

Description

const showAlert = props => **props.status** === PENDING;

const Alert = (props) => {
  if (showAlert(props)) {
    return (
      <div />
    );
  }

  return <noscript/>;
};

Alert.propTypes = {
  **status**: PropTypes.oneOf([PENDING, ACCEPTED, CANCELED])
};

In this case props.status is being used inside of the function showAlert.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions