<button className="close" onClick={handleClick(item.id)}>
<button className="close" onClick={()=>handleClick(item.id}>
This is basically button created to delete the elements from the UI using react state . Now in the 1st one all the elements got deleted as soon as the page loads
In 2nd one they are deleted only when we click them . I am unable to understand why this is happening .