Destructure With Access To Nested Value And Parent Value
const Component = ({ data: { name: displayName }}) => {
return (
<div>
<h1>{displayName}</h1>
<SubComponent />
</div>
);
};const Component = ({ data }) => {
const { name: displayName } = data;
return (
<div>
<h1>{displayName}</h1>
<SubComponent data={data} />
</div>
);
};Last updated