JSFiddle - React, Tailwind, and code Playground
JavaScript
// рендер разметки по условию
if (item < 0) {
alert("warning")
} else {
currentItem.push(info);
render([info]);
update();
}
//Запрос на получение суммы
fetch(url, options)
.then((response) => response.json())
.then((result) => {
if (result.result === 0) { //если 0 то разметку не рендерить
alert("Not found");
} else {
alert("Found")
}
})
/*------------------------------------------------------------------*/
if (item < 0) {
alert("warning")
} else {
fetch(url, options)
.then((response) => response.json())
.then((result) => {
if (result.result === 0) {
alert("Not found");
} else {
currentItem.push(info);
render([info]);
update();
}
})
}