const {
user: { name }
} = props;
With the above code, I got
name of undefined when the
userobject is undefined
I like destructing but should it be used this way? The issue is there's no fallback to crash my react app. I rather do destruct and use ? as a fallback:
const {
user
} = props;
return <div>user?.name</div>
propslook like?