Reputation: 8411
I have this useEffect hook:
useEffect(() => {
console.log(1)
}, [someObject.someProperty.someNestedProperty])
Now lets say that someProperty
is undefined.
It will force blank white screen - how to handle this in useEffect hook?
Upvotes: 0
Views: 39
Reputation: 1033
Can you try this ?
useEffect(() => {
if (someObject?.someProperty?.someNestedProperty) {
console.log(1)
}
}, [someObject])
Upvotes: 2