I pass the key of my Hook that I map, like this :
Object.entries(userWalletIncomes).map(([key, value]) => {
return (
<div id="incomeTable" className="text-left mx-auto flex" key={key}>
<p className="w-32 border p-1 capitalize">{key} :</p>
<p className="w-32 border p-1 text-green-500">{value}€</p>
<button onClick={(key) => handleDeleteIncome(key)}><i className="fas fa-times text-red-400 border p-1"></i></button>
</div>
)
})
And on click on the button, I give the key in the call of the function.
When I log it, instead of giving the simple string, it gives me this :
SyntheticBaseEvent {_reactName: "onClick", _targetInst: null, type: "click", nativeEvent: MouseEvent, target: i.fas.fa-times.text-red-400.border.p-1, …}
Inside of this object, there isn't my key. I don't understand why. Where is my mistake ? 🤨
Thanks for helping me understand