buildo/react-placeholder

propTypes React-Placeholder required on children

r17x opened this issue · 2 comments

r17x commented

I use and extends Google Standard (Eslint) for write code,
on google standard can't assign children props, if don't assign children value then i got a error message from prop-types required for children props.

like this message
image

have any solution for it?

thansk
-ri7nz

Are you sure? children are a basic prop supported by any react component, It's hard to believe that Google Standard forbids it's usage. Maybe it forbids only passing children as prop instead of as JSX children?

I explain myself:

// you can pass children as a normal prop
<Component children={<div />} />

// or as normal JSX/HTML children
<Component>
  <div />
</Component>

Are both forbidden by you ESLint rule?

r17x commented

I'm so sorry, I'm wrong, it turns out a react / no-children-prop error message from eslint-plugin-react is not from Google Standard.

I explain

// you can pass children as a normal prop
<Component children={<div />} />

// or as normal JSX/HTML children
<Component>
  <div />
</Component>

and got an error from eslint

react/no-children-props: do not pass children as props. Instead,  nest children between the opening and closing  tags.

thank you so much @FrancescoCioria