From 6f3c5518ca520effa0450649ab586c92b2555265 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Thu, 4 Apr 2024 12:00:06 -0700 Subject: [PATCH] Feat: provide root context as method on virtualdom (#2243) --- packages/core/src/virtual_dom.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index d15ae06d6..3c851c342 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -361,6 +361,11 @@ impl VirtualDom { self } + /// Provide a context to the root scope + pub fn provide_root_context(&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