today I want to ask about "return" in the function of JavaScript,
const handleCloseModal = async () => {
const check = await getConfirm({
message: v.__confirm_exit,
type: "confirm",
});
if (!check) return;
setShowModal(false);
};
can I make getConfirm return instant and handleCloseModal will return too if the check is False? For example, I want handleCloseModal will auto return if check false
const handleCloseModal = async () => {
const check = await getConfirm({
message: v.__confirm_exit,
type: "confirm",
});
setShowModal(false);
};
or better don't need to declare check
const handleCloseModal = async () => {
getConfirm({
message: v.__confirm_exit,
type: "confirm",
});
setShowModal(false);
};
Thank you!
Aucun commentaire:
Enregistrer un commentaire