-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs] Add a composition section #6049
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few grammar tweaks and a question...
docs/customization/composition.md
Outdated
|
||
In order to provide the maximum flexibility and performance, | ||
we need a way to know the nature of the children elements components | ||
receive as property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the child elements a component receives"?
docs/customization/composition.md
Outdated
with a `muiName` static property. | ||
|
||
However, users like to wrap components in order to enhance them. | ||
That's conflicting with our `muiName` solution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"to enhance them, which can conflict with our muiName
solution.
docs/customization/composition.md
Outdated
In order to provide the maximum flexibility and performance, | ||
we need a way to know the nature of the children elements components | ||
receive as property. | ||
To solve that problem we tag some of our components when needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"this problem"
docs/customization/composition.md
Outdated
|
||
However, users like to wrap components in order to enhance them. | ||
That's conflicting with our `muiName` solution. | ||
If you encounter that issue, you need to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"this issue"
docs/customization/composition.md
Outdated
That's conflicting with our `muiName` solution. | ||
If you encounter that issue, you need to: | ||
1. Forward the properties. | ||
2. Use the same tag for your wrapping component that used with the wrapped component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"that is used"
|
||
## API consistency | ||
|
||
You may have noticed some inconsistency in our API regarding composting components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
composting components
😆 We have a few of those on master
!
docs/customization/composition.md
Outdated
To provide some transparency, we have been using the following rules when designing the API: | ||
|
||
1. Using the `children` property is the idiomatic way to do composition with React. | ||
2. When we need limited children composition, providing explicit property is making the implementation simpler and more performant. For instance, the `<Tab />` takes an `icon` and a `label` property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we need limited children composition
"limited child composition" perhaps? But what does that mean?
You missed one! |
Oups 🍂 |
Closes #6041.