I have been working with react for quite some time and i still somehow wonder what type of opjects can i put inside the dependecy array of react hooks (doesnt matter what hook is it), how exactly is react comparing single items inside the dependecy array and should i parse large objects like lists or nested js objects?
for example here is a object the i want useCallback to change whenever a list inside it changes:
function App(){
const [array,setArray] = useState([{first:'jimmy',last:'willow'}]);
const someCallback = useCalback(()=>{
window.alert(JSON.stringify(array))
}, [array]) // here I wonder what should I usually put? just the array or should I parse it to string to something like that....
// ... somthing here changes the state
return array.map(({first,last})=><div onClick={someCallback}>{first} , {last} </div>)
}