WebDevSimplified / useful-custom-react-hooks

1.95k stars 687 forks source link

Probably not an issue #10

Closed 8key closed 3 years ago

8key commented 3 years ago

https://github.com/WebDevSimplified/useful-custom-react-hooks/blob/f5dda2e69d51e5da52aa75f21c6e83610def5923/src/5-useArray/useArray.js#L30

Only works if i do return [ array, setArray, push, filter, update, remove, clear ] and in code const [array, setArray, push, filter, update, remove, clear] = useArray([])

Not sure why it doesn't work if returning by object, gives me undefined.

WebDevSimplified commented 3 years ago

Most likely the way you are implementing the array is incorrect. Make sure you use set and not setArray when referencing the set method from your code. { set } = useArray([]).