This repository was archived by the owner on Sep 1, 2024. It is now read-only.
This repository was archived by the owner on Sep 1, 2024. It is now read-only.
Ambiguous/misleading/incorrect documentation regarding PropTypes.node
. #154
Closed
Description
// Anything that can be rendered: numbers, strings, elements or an array
// (or fragment) containing these types.
optionalNode: PropTypes.node,
// A React element.
optionalElement: PropTypes.element,
Upon reading this, I -- and a member of my team -- came away with the understanding that PropTypes.node
was suitable for things such as DOM nodes/elements (e.g. event.currentTarget
). After poring over the code here, it appears that this is not the case and that the only type of "node" that's allowed is a React node.
I'd recommend at least updating the wording on this. Perhaps something of the form:
// A single React element.
optionalElement: PropTypes.element,
// Anything that can be rendered, excluding raw DOM elements: numbers, strings, React elements or an array/fragment thereof.
optionalNode: PropTypes.node,
Metadata
Metadata
Assignees
Labels
No labels