**trying the following The button will first be disabled when the promise fires. It will remain disabled until the promise resolves, where it will then be enabled again. Please advise as I am stuck here and not sure whether its the right thing **
let [enabled] = useState(false);
const getTotal = event => {
enabled = false;
calTotal().then(validateResult => {
// enabled = true;
});
}
<Button
onClick={() => new Promise((resolve) => {
resolve({
getTotal();
})
})}>Get Total</Button>