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.
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([]).
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 codeconst [array, setArray, push, filter, update, remove, clear] = useArray([])
Not sure why it doesn't work if returning by object, gives me undefined.