mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-09-20 14:21:58 +00:00
Feat: provide root context as method on virtualdom (#2243)
This commit is contained in:
parent
821a650f77
commit
6f3c5518ca
1 changed files with 5 additions and 0 deletions
|
@ -361,6 +361,11 @@ impl VirtualDom {
|
|||
self
|
||||
}
|
||||
|
||||
/// Provide a context to the root scope
|
||||
pub fn provide_root_context<T: Clone + 'static>(&self, context: T) {
|
||||
self.base_scope().state().provide_context(context);
|
||||
}
|
||||
|
||||
/// Build the virtualdom with a global context inserted into the base scope
|
||||
///
|
||||
/// This method is useful for when you want to provide a context in your app without knowing its type
|
||||
|
|
Loading…
Reference in a new issue