-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Allow any type to be used as children #3042
Conversation
# Conflicts: # tools/Cargo.lock
Visit the preview URL for this PR (updated for commit d8f0178): https://yew-rs--pr3042-make-mut-rkaxx4l8.web.app (expires Fri, 09 Jun 2023 13:27:47 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - SSRYew Master
Pull Request
|
Size Comparison
|
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.
If you update the PR i think we could merge it.
I think this pull request still needs some small tidying up around how optional types are being converted. |
Superseded by #3289. |
Description
Partially addresses #3022.
This pull request makes the following changes:
Allowing any type to be passed as
children
as long asIntoPropValue<T>
for children with typeT
.E.g.: One can now use render props as children:
Children
is now a type alias ofVList
.Users can now choose between Children (
VList
), ChildrenWithProps(ChildrenRenderer<VChild<T>>
)and
Html
for html-like children with various upside and downside based on their choice.When a component has only 1 child, it does not pass through an iterator and
Vec
.VList
holds children inRc<Vec<VNode>>
hence makes it cheap to clone.VTag
now holdsVNode
as its children type. This optimises for single child VTag by avoiding an allocation of single child VList.Checklist