我想在单击退格键或空值时清除一个值。当我们单击退格键时,始终会设置第一个选定的值
onValueChange(e,value)
{
if(e.target === undefined){
this.setState({value:e});
}
else
{
this.setState({value:e.target.value})
}
const { patientsMasterData, addPatientForm } = this.props;
let selectedRefValue = patientsMasterData.ReferredBy.filter(o=> o.RefName === (value.options));
if(selectedRefValue.length !== 0) {
addPatientForm.values.ReferredBy = selectedRefValue[0].RefID;
}
else{
addPatientForm.values.ReferredBy = null;
}
}
如何首先将值设置为null?