-
-
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
Port yew-autoprops to yew-macro #3505
Merged
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6866d0d
Port yew-autoprops to yew-macro
cecton b5199be
clippy
cecton fd79b58
rustfmt nightly
cecton df251e3
Remove unnecessary unit when no props are provided
cecton 9f2f258
Making sure field's attrs are transmitted to the Properties struct
cecton 0e818ba
Update doc
cecton 64dfc9f
Fix error message typo
kirillsemyonkin 98f62b5
update stderr
cecton 7643e92
Fix: allow generics not used in argument
cecton ed70758
Replace derive PartialEq with manually built PartialEq
cecton fe7d0b3
Fix test & cleanup warnings
cecton ee441f3
Update stderr
cecton 63e29db
Improve error message & update stderr
cecton 3738026
Update website/docs/concepts/function-components/properties.mdx
cecton 5eac208
Merge commit 1d889347a6205a2dc79c1d1fea9d49092c0627db (no conflict)
cecton 080d6f2
Remove macro, keep only doc
cecton 60d9c4f
Improve doc to use AttrValue and &Props { ... }
cecton 781edd6
Failed my previous removal somehow
cecton 50f3666
Remark on the order of the macros
cecton 15a27ac
Various fixes
cecton f883b7c
Update dependencies
cecton d9b1532
update stderr
cecton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm using the syntax proposed here: yewstack/implicit-clone#39 (comment) by Alex Parrill. I think this should appear a lot more in the doc. (Please let me know your opinion on this.)
I think I learned that syntax in the context of
match
at the beginning I was using Rust but then I completely forgot about it and I'm not sure I have ever saw it used in destructuring like that.Most of the time you will want to use this syntax. Actually probably always. Because it allows dereferencing the primitive types automatically (the Copy-able types). For types that are Implicit-lyCloneable like AttrValue it's actually best to take them by reference because you can pass that reference directly to the properties of child component. And it won't move it because it's a reference.
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.
It's certainly handy to know, but not to always use, since writing the name of the props type twice can get cumbersome really fast. If only Rust had something like anonymous struct patterns...
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.
YESSS I know..... well at least autoprops makes it easier in both ways (Prop struct creation + destructuring)