Closed
Description
I am going to copy the bits here:
One way to solve this issue without context is to pass down the
Avatar
component itself so that the intermediate components don't need to know about theuser
prop:
The text before this talks about user
and avatarSize
but the text only mentions user
prop. Additionally, the Page component in the snippet below uses user
and avatarSize
props. The usage code shows only user
prop being passed to Page component (sorry removed comments from the snippet as I am currently translating the comments and copied it from currently working localization repo).
function Page(props) {
const user = props.user;
const userLink = (
<Link href={user.permalink}>
<Avatar user={user} size={props.avatarSize} />
</Link>
);
return <PageLayout userLink={userLink} />;
}
<Page user={user} />
<PageLayout userLink={...} />
<NavigationBar userLink={...} />
{props.userLink}