Skip to content

Commit 1a6b6b5

Browse files
committed
replaced ternary with if/else for the error condition
1 parent 60f7f10 commit 1a6b6b5

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

packages/react-dom-bindings/src/shared/ReactControlledValuePropTypes.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@ export function checkControlledValueProps(
3232
props.value == null
3333
)
3434
) {
35-
console.error(
36-
'You provided a `value` prop to a form field without an ' +
37-
'`onChange` handler. This will render a read-only field. If ' +
38-
'the field should be mutable use `defaultValue`. Otherwise, set %s.',
39-
tagName === 'select' ? '`onChange`' : 'either `onChange` or `readOnly`',
40-
);
35+
if (tagName === 'select') {
36+
console.error(
37+
'You provided a `value` prop to a form field without an ' +
38+
'`onChange` handler. This will render a read-only field. If ' +
39+
'the field should be mutable use `defaultValue`. Otherwise, set `onChange`.',
40+
);
41+
} else {
42+
console.error(
43+
'You provided a `value` prop to a form field without an ' +
44+
'`onChange` handler. This will render a read-only field. If ' +
45+
'the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.',
46+
);
47+
}
4148
}
4249

4350
if (

0 commit comments

Comments
 (0)