Function sycamore::reactive::provide_context
source · [−]pub fn provide_context<T>(cx: BoundedScope<'_, '_>, value: T) -> &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.
This method is simply a wrapper around create_ref
and provide_context_ref
.
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.