clean up some core context APIs
This commit is contained in:
1 parent
d51b6268eb
commit
6c29e2b825
4 files changed
+7
-7
No files matched your search
@@ -38,8 +38,8 @@ pub fn has_context<T: 'static + Clone>() -> Option<T> {
|
||||
}
|
||||
|
||||
/// Provide context to the current scope
|
||||
pub fn provide_context<T: 'static + Clone>(value: T) -> Option<T> {
|
||||
with_current_scope(|cx| cx.provide_context(value))
|
||||
pub fn provide_context<T: 'static + Clone>(value: T) -> T {
|
||||
with_current_scope(|cx| cx.provide_context(value)).expect("to be in a dioxus runtime")
|
||||
}
|
||||
|
||||
/// Provide a context to the root scope
|
||||
|
||||
@@ -338,8 +338,8 @@ impl ScopeId {
|
||||
}
|
||||
|
||||
/// Provide context to the current scope
|
||||
pub fn provide_context<T: 'static + Clone>(self, value: T) -> Option<T> {
|
||||
with_scope(self, |cx| cx.provide_context(value))
|
||||
pub fn provide_context<T: 'static + Clone>(self, value: T) -> T {
|
||||
with_scope(self, |cx| cx.provide_context(value)).expect("to be in a dioxus runtime")
|
||||
}
|
||||
|
||||
/// Suspends the current component
|
||||
|
||||
Reference in new issue
Block a user