I will try to be as short as possible. So basically I have a react app where I am mapping over an array of objects where each object is a row in a table. At the end of each row, there is a delete button to which I'm passing a jsx 'id' attribute (retrieved from the object) so I know which row to delete. When the button is clicked I am passing this function:
const handleDelete = (e) => {
console.log(e.target.id);
const passedId = e.target.id;
let newdata = data.filter((obj) => obj.id != passedId); // != works fine !== returns the same array
console.log(newdata);
//axios stuff
}
I want to filter the array so that it doesn't include the object with the passed id. In the console-logs e.target.id as expected is an integer, the id of the object is also an integer. Then why doesn't strictly not equal (!==) work as well?