WebDevSimplified / useful-custom-react-hooks

1.95k stars 687 forks source link

Bug in useArray #11

Closed 3noix closed 3 years ago

3noix commented 3 years ago

In the "update" and "remove" functions, it should be "a.length" instead of "a.length-1", as with the "slice" function, the second index is not included in the result. The problem can even be seen in the result of the demo in the youtube video (after 9m55 in https://www.youtube.com/watch?v=0c6znExIqRw)

WebDevSimplified commented 3 years ago

Good catch. This will be fixed in the next update I make to the library. I have 5 hooks I am planning to add in a week or so.