Can you have an array as a dependancy for the useMemo hook?
I know this would be fine:
const dep1 : string = '1'
const thing = useMemo(()=>{
// stuff
},[dep1])
But what about this?:
const dep2 : string[] = ['1', '2']
const thing2 = useMemo(()=>{
// stuff
},[dep2])
I thought that I read once that objects and arrays will always return false for the equality check, effectively meaning thing2 will never be memoized. However I can't see this in the docs:
https://reactjs.org/docs/hooks-reference.html#usememo
This is a contrived example as dep1 and dep2 are constant variables but imagine they were a prop where the value would change.