this.props.children and `react/prop-types` rule
See original GitHub issueUsing this.props.children
triggers the rule (“‘children’ is missing in props validation”).
Shouldn’t it be an exception?
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:21 (5 by maintainers)
Top Results From Across the Web
this.props.children and `react/prop-types` rule · Issue #7 - GitHub
With React.PropTypes.element you can specify that only a single child can be passed to a component as children. propTypes: { children: React ...
Read more >ReactJs: What should the PropTypes be for this.props.children?
2. You probably want node. – lux · 1. Possible duplicate of only allow children of a specific type in a react component....
Read more >Typechecking With PropTypes - React
With PropTypes.element you can specify that only a single child can be passed to a component as children. import PropTypes from 'prop-types'; class...
Read more >How to validate React props using PropTypes - LogRocket Blog
Learn how to validate props with React PropTypes, React's internal mechanism for adding type checking to component props.
Read more >[React] Solution for 'children' is missing in props validation ...
If you came up with this error message “ 'children' is missing in props validation eslint(react/prop-types)” , this article might help.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
All good points. [UPDATED] I think @AsaAyers is onto something, considering the Single Child section in the React doc:
In other cases when
this.props.children
might be used (or not), this below could probably do the trick:Just to clarify,
children
should be defined as typenode
, like this: