In react js, if someone used list object mapping to a list as follow:
const removeUser = (email)=>{
alert(email)
}
const usersList = users.map((user) =>
<li key={user._id}>
{user.Name}
{ isAdmin && <FontAwesomeIcon icon={faTrashAlt} onClick={removeuser(user.Email)}/>}
</li>
);
in here, the function inside onClick event is automatically triggered when mounting the list elements component. it will prompt alerts with email addresses automatically.