Skip to content

"Advanced Topics > Context" regarding component composition source code and description do not match #1706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GasimGasimzada opened this issue Feb 19, 2019 · 2 comments

Comments

@GasimGasimzada
Copy link
Contributor

GasimGasimzada commented Feb 19, 2019

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 the user 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}
@GasimGasimzada GasimGasimzada changed the title "Advanced Topics > Context" regarding component composition source code and text do not match "Advanced Topics > Context" regarding component composition source code and description do not match Feb 19, 2019
@tesseralis
Copy link
Member

Good catch! It should say

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 the user or avatarSize props

<Page user={user} avatarSize={avatarSize} />

@GasimGasimzada
Copy link
Contributor Author

#1737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants