Skip to content

Commit 9854be2

Browse files
committed
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.
1 parent ef67406 commit 9854be2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/ReactPropTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var emptyFunction = require('emptyFunction');
5555
* // An optional string or URI prop named "href".
5656
* href: function(props, propName, componentName) {
5757
* var propValue = props[propName];
58-
* if (typeof propValue === 'string' || propValue instanceof URI) {
58+
* if (propValue != null && typeof propValue !== 'string' && !(propValue instanceof URI)) {
5959
* return new Error(
6060
* 'Expected a string or an URI for ' + propName + ' in ' +
6161
* componentName

0 commit comments

Comments
 (0)