Closed
Description
Hi, I came across the issue with react/prop-types rule.
import React from 'react';
import PropTypes from "prop-types";
const DisplayName = (props) => {
const getNameDiv = () => {
return <div>{props.name}</div>;
};
return getNameDiv();
};
DisplayName.propTypes = {
name: PropTypes.string.isRequired,
};
gives me warning 'name' is missing in props validation react/prop-types
. Same thing happens if I rewrite function to function getNameDiv() {...}
After inlining getNameDiv
there is no warning:
import React from 'react';
import PropTypes from "prop-types";
const DisplayName = (props) => {
return <div>{props.name}</div>;
};
DisplayName.propTypes = {
name: PropTypes.string.isRequired,
};
I was looking for similar issues but I didn't find any. Maybe #1605 is connected?
I was using eslint-plugin-react: 7.11.1
but it's the same for 7.13.3
.
Thanks!