Array.splice doesn't work properly
Opened this issue · 0 comments
sinnlosername commented
The second parameter of the Array.splice()
function should be optional. If it's not set, it'll splice the array until the end.
What should happen:
let test = [1,2,3];
test.splice(0);
console.log(test); // Outputs []
What happens when using the .splice()
function from useArrayState() actions:
let [values, valueActions] = useArrayState([1,2,3]);
useEffect(() => valueActions.splice(0));
return (<>{JSON.stringify(values)}</>); // Shows [1,2,3]