File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed
packages/react-dom/src/server Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -568,19 +568,22 @@ let didWarnSelectedSetOnOption = false;
568
568
569
569
function checkSelectProp ( props , propName ) {
570
570
if ( __DEV__ ) {
571
- const array = isArray ( props [ propName ] ) ;
572
- if ( props . multiple && ! array ) {
573
- console . error (
574
- 'The `%s` prop supplied to <select> must be an array if ' +
575
- '`multiple` is true.' ,
576
- propName ,
577
- ) ;
578
- } else if ( ! props . multiple && array ) {
579
- console . error (
580
- 'The `%s` prop supplied to <select> must be a scalar ' +
581
- 'value if `multiple` is false.' ,
582
- propName ,
583
- ) ;
571
+ const value = props [ propName ] ;
572
+ if ( value != null ) {
573
+ const array = isArray ( value ) ;
574
+ if ( props . multiple && ! array ) {
575
+ console . error (
576
+ 'The `%s` prop supplied to <select> must be an array if ' +
577
+ '`multiple` is true.' ,
578
+ propName ,
579
+ ) ;
580
+ } else if ( ! props . multiple && array ) {
581
+ console . error (
582
+ 'The `%s` prop supplied to <select> must be a scalar ' +
583
+ 'value if `multiple` is false.' ,
584
+ propName ,
585
+ ) ;
586
+ }
584
587
}
585
588
}
586
589
}
You can’t perform that action at this time.
0 commit comments