docs: fixed nested ternary operator in Form (#27724)

This commit is contained in:
Shivam Modi 2020-11-12 20:50:13 +05:30 committed by GitHub
parent 652374ff4c
commit 3d04e5d3fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,9 +31,17 @@ class Demo extends React.Component {
formRef = React.createRef<FormInstance>();
onGenderChange = value => {
this.formRef.current.setFieldsValue({
note: `Hi, ${value === 'male' ? 'man' : value === 'female' ? 'lady' : 'there'}!`,
});
switch (value) {
case 'male':
this.formRef.current.setFieldsValue({ note: 'Hi, man!' });
return;
case 'female':
this.formRef.current.setFieldsValue({ note: 'Hi, lady!' });
return;
case 'other':
this.formRef.current.setFieldsValue({ note: 'Hi there!' });
return;
}
};
onFinish = values => {