test.js
const PatientInfoModal = ({ visible, onCancel, onEditPatient,
setVisible, editid, editname, editgender,
editage, editbirth_date, editkey }) =>{
....
function onOk(values) {
const { patient } = values;
const { id, name, gender, age, birth, editkey } = patient;
onEditPatient({ name, gender, age, birth_date, editkey });
if (id == '' ) {
onEditPatient({id: 'flase'})
} else if (id !== '') {
onEditPatient({id: 'true'})
}
}
When using an if statement, I want to enter'false' if the id value is undefined, and'true' if defined.
However, in all cases the undefined value appears.
It seems that the id value is not defined. How can I put'flase' and'true' in the id value?
It seems that the pid of the if statement cannot read the value of const {pid}. Let me know if you know how
Aucun commentaire:
Enregistrer un commentaire