JSFiddle - React, Tailwind, and code Playground
JavaScript
var ar = [ {id:1, str:"a"}, {id:2, str:"b"}, {id:3, str:"c"}, {id:4,str:"d"} ];
ar.removeById = id => ar.findIndex(x=>x.id==id) >=0 ? ar.splice(ar.findIndex(x=>x.id==id),1) : undefined;
console.log('initial',ar);
ar.removeById(3);
console.log('after removing 3',ar);
ar.removeById(3);
console.log('after removing 3 again',ar);