Function sycamore::reactive::provide_context_ref
source · [−]pub fn provide_context_ref<T>(cx: BoundedScope<'a, 'a>, value: &'a T) -> &'a Twhere
T: 'static,
Expand description
Provides a context in the current Scope
. The context can later be accessed by using
use_context
lower in the scope hierarchy.
The context can also be accessed in the same scope in which it is provided.
Unlike provide_context
, this method accepts a reference that
lives at least as long as the scope.
Panics
This method panics if a context with the same type exists already in this scope. Note that if a context with the same type exists in a parent scope, the new context will shadow the old context.