pub fn provide_context<T>(value: T)where
T: Clone + 'static,
Expand description
Sets a context value to be stored in the reactive system. The stored context value can be retrieved from anywhere by using use_context
ยงExample
In a parent component:
provide_context(42);
provide_context(String::from("Hello world"));
And so in a child component you can retrieve each context data by specifying the type:
let foo: Option<i32> = use_context();
let bar: Option<String> = use_context();