Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that instanceOf is not suitable for Elements. However at the point we might as well is PropTypes.object or check against
Node.nodeType
. But this requires a custom validator.I think a custom validator is better suited for this one (using #10)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand it correctly, with #10, we can do:
detail
However, I don't think that it's enough/necessary:
PropTypes.instanceOf(typeof Element === 'undefined' ? Object : Element)
.This sounds like a great proposal. What about we move forward with it? cc @merceyz.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost. We don't need instanceOf check at all as far as I can tell. Checking
props.container.nodeType
should be enough. To be honest I think most use cases should usenodeType
. instanceOf is only useful if you want to make sure that an element comes from the same or different realm.