Feat: provide root context as method on virtualdom (#2243)

This commit is contained in:
Jonathan Kelley 2024-04-04 12:00:06 -07:00 committed by GitHub
parent 821a650f77
commit 6f3c5518ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -361,6 +361,11 @@ impl VirtualDom {
self 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 /// 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 /// This method is useful for when you want to provide a context in your app without knowing its type