add must use to several hooks
This commit is contained in:
1 parent
04f83e1e92
commit
3bf6d2d7cf
21 files changed
+25
No files matched your search
@@ -3,6 +3,7 @@ use dioxus_core::ScopeState;
|
||||
/// Consume some context in the tree, providing a sharable handle to the value
|
||||
///
|
||||
/// Does not regenerate the value if the value is changed at the parent.
|
||||
#[must_use]
|
||||
pub fn use_context<T: 'static + Clone>(cx: &ScopeState) -> Option<&T> {
|
||||
cx.use_hook(|| cx.consume_context::<T>()).as_ref()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user