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:
Mariano Desanze 2014-06-27 11:50:03 -03:00
parent ef67406272
commit 9854be2e46
1 changed files with 1 additions and 1 deletions

View File

@ -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