Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

fix: Updating proptypes to not warn for multiple children within Block #74

Closed
wants to merge 1 commit into from

Conversation

ammiranda-isp
Copy link
Contributor

This change updates Block's propTypes to accept both a single child or array of children. Currently Block will issue propType warnings in the console when more than one child is passed to it.

ref: https://stackoverflow.com/a/42122662

@ammiranda-isp ammiranda-isp requested a review from a team June 5, 2019 22:02
@nathanyoung
Copy link
Contributor

According to the react docs, PropTypes.node is

// Anything that can be rendered: numbers, strings, elements or an array
// (or fragment) containing these types.
optionalNode: PropTypes.node,

I'm confused why we would be getting warnings?

@ammiranda-isp
Copy link
Contributor Author

Hmm based on more digging it looks like you are right that the existing prop-type should cover for one or more children (ref: jsx-eslint/eslint-plugin-react#7). And it looks like the prop-type warning results because some of the children rendered are portal'ed which is an existing bug on prop-types (ref: facebook/prop-types#167). Closing this, thanks for keeping me honest.

@nathanyoung nathanyoung deleted the fix-prop-type-warning-with-block branch July 23, 2019 22:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants