I am facing a bug that I cant use the .slice() method of javascript in react, basically I call the slice() method inside a function in class-based component, and the function in which I put the slice is passed to 2 levels down child component and triggered from there onClick event but the issue is that the slice method is not doing its work of removing element it just consoles the same array, here I show you the code in simple concept,
useSlice = () => {
let arr = ['a', 'b', 'c'];
console.log(arr.slice(1, 1));
}
useSlice()
this code print the same values of the array in the console instead of displaying the modified array. What to do ???