-
-
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
Refactor use ref hooks #2093
Refactor use ref hooks #2093
Conversation
`use_ref` has been renamed to `use_mut_ref` and `use_ref` has become a similar hook for immutable reference. This is different from React but I think lines up nicely with Rust as a reference is immutable unless specified to be a mut ref.
Visit the preview URL for this PR (updated for commit 8b64369): https://yew-rs--pr2093-use-ref-6ujaz3md.web.app (expires Sun, 28 Nov 2021 12:57:22 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
I'm going to take over this PR. Hopefully we can land it quickly for 0.19 |
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.
LGTM
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.
love this
@hamza1311 btw if you want this merged you can just approve, since this PR is not yours :D |
I would approve but it is my PR 🙃 |
I will approve it instead |
* Refactor use ref hooks `use_ref` has been renamed to `use_mut_ref` and `use_ref` has become a similar hook for immutable reference. This is different from React but I think lines up nicely with Rust as a reference is immutable unless specified to be a mut ref. * fix CI Co-authored-by: Hamza <muhammadhamza1311@gmail.com> (cherry picked from commit 071f1b2)
use_ref
has been renamed touse_mut_ref
anduse_ref
has become asimilar hook for immutable reference.
This is different from React but I think lines up nicely with Rust as a
reference is immutable unless specified to be a mut ref.
This PR also adds
use_node_ref
which is a specialised version ofuse_ref
for
NodeRef
- it is more ergonomic to have this separate hook and it avoidsthe need of wrapping an
Rc
value in anotherRc
.Description
Fixes #1642
Checklist
cargo make pr-flow