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.
Mariano Desanze committed
Jun 27, 2014 at 11:50 UTC
9854be2e4693355fab1b020059c14542c400eded
1 file changed
+1
-1
src/core/ReactPropTypes.js
+1
-1
@@ -55,7 +55,7 @@ var emptyFunction = require('emptyFunction');
55
* // An optional string or URI prop named "href".
56
* href: function(props, propName, componentName) {
57
* var propValue = props[propName];
58
- * if (typeof propValue === 'string' || propValue instanceof URI) {
58
+ * if (propValue != null && typeof propValue !== 'string' && !(propValue instanceof URI)) {
59
* return new Error(
60
* 'Expected a string or an URI for ' + propName + ' in ' +
61
* componentName