Closed
Description
In the case a null
argument is passed to a property marked as isRequired
:
http://jsfiddle.net/jeanlauliac/0n6snb6b/1/
We'll get a proper warning in the console: Warning: Required prop
namewas not specified in
Hello.
(though it should probably be "prop was null" and not "prop was not specified", but anyway)
On the other hand, the default value is only used when the prop is undefined
, but not when it's null
. Is this the explicitly wanted behavior? If it is, then we should probably make the documentation explicit about it (http://facebook.github.io/react/docs/reusable-components.html), giving the entire responsibility to component callers of safeguarding against null
.
Metadata
Metadata
Assignees
Labels
No labels