-
-
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
Upgraded Hook API (2) #1780
Upgraded Hook API (2) #1780
Conversation
# Conflicts: # packages/yew-functional/Cargo.toml # packages/yew-functional/src/hooks/use_reducer.rs
Visit the preview URL for this PR (updated for commit a7e23ab): https://yew-rs--pr1780-hook-api-b96cfhqi.web.app (expires Wed, 12 May 2021 20:04:04 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
What about |
@pickfire, what's wrong with passing a closure though? It is possible to have a different function but I don't think that offers any benefits. |
You don't want to pass values directly because they will get stack allocated each time the function is run. The closure prevents the creation of the object when it won't be used - as it probably won't because this is a hook setup. Clippy will warn about this too and discourages the use |
# Conflicts: # packages/yew-functional/src/hooks/mod.rs # packages/yew-functional/src/lib.rs
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.
Mostly some adjustments to use Yew conventions
Description
This PR takes over the work done by @jkelleyrtp in #1645 as that PR has been inactive for quite a while. I have also applied the review suggestions and updated documentation.
I tried to keep @jkelleyrtp's original commits as much as I could. Almost all of the code updates in this PR are theirs.
Fixes #1644
Fixes #1757
Closes #1645 (supersedes it)
Checklist
cargo make pr-flow