Fix to sample code for href in ReactPropTypes
Error should be thrown in the previous condition is "not" meet. And the href propType is described as optional in the comment, but the null check was missing.
This commit is contained in:
parent
ef67406272
commit
9854be2e46
|
@ -55,7 +55,7 @@ var emptyFunction = require('emptyFunction');
|
|||
* // An optional string or URI prop named "href".
|
||||
* href: function(props, propName, componentName) {
|
||||
* var propValue = props[propName];
|
||||
* if (typeof propValue === 'string' || propValue instanceof URI) {
|
||||
* if (propValue != null && typeof propValue !== 'string' && !(propValue instanceof URI)) {
|
||||
* return new Error(
|
||||
* 'Expected a string or an URI for ' + propName + ' in ' +
|
||||
* componentName
|
||||
|
|
Loading…
Reference in New Issue