reactjs method not being called in render method
I have a function to delete elements from an array in the state given its index. Here it is:
removeFromRowsById(index) {
console.log("IN REMOVE FUNCTION");
const newList = this.state.rows1;
newList.splice(index, 1);
this.setState({ rows1: newList });
}
I call it in my render method like this:
this.removeFromRowsById.bind(this, this.state.rows1.indexOf(this.returnValueToDelete(this.state.rows1[1]["id"])))
this.state.rows1.indexOf(this.returnValueToDelete(this.state.rows1[1]["id"])) returns the object inside rows1 that I want removed.
The problem is, when I call it, nothing happens. It seems like it never goes in the method since "IN REMOVE FUNCTION" never gets logged in the console. Any type of help i highly appreciated it. I'm new to reactjs and I've been working on this for quite some time. Thanks!