'How to set state when a button is clicked
I want to set user.Id in setDelid when the button is clicked.
<div className="users">
{users.map((user) => {
return (
<div className="users" key={user.Id} >
<p>
Name: {user.Title}, EmpID: {user.EmpID}, ID: {user.Id}
</p>
<button onClick={deleteData} onChange={(user) => setDelid(user.Id)} className="button button4"></button>
</div>
);
})}
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
