If a propType isn't required why does ESLint want to provide default prop for it?

Nat Geo picture Nat Geo · Sep 14, 2018 · Viewed 9.9k times · Source
const propTypes = {
  label: PropTypes.string,
};
const defaultProps = {};

Why does ESLint want us to provide default value for label when it is not required?

(react/require-default-props)

I am extending airbnb

Answer

Osman Safak picture Osman Safak · Jan 26, 2019

I had the same problem. I used this as a solution.

const propTypes = {
  lable: PropTypes.string,
};
const defaultProps = {
  lable: '',
};