const handleEdit = (e) => { console.log(`edit ${e.target.getAttribute("value")}`); let idx = parseInt(e.target.getAttribute("value")) - 1; setEIdx(idx); setTargetEditCustomer(customersArr[idx]); handleEditToggle(); }; code example
Example: const handleEdit = (e) => { console.log(`edit ${e.target.getAttribute("value")}`); let idx = parseInt(e.target.getAttribute("value")) - 1; setEIdx(idx); setTargetEditCustomer(customersArr[idx]); handleEditToggle(); };
const handleEdit = (e) => {
console.log(`edit ${e.target.getAttribute("value")}`);
let idx = parseInt(e.target.getAttribute("value")) - 1;
setEIdx(idx);
setTargetEditCustomer(customersArr[idx]);
handleEditToggle();
};