pub fn use_context<T>() -> Option<T>where
T: Clone + 'static,
Expand description
Try to retrieve a stored Context value in the reactive system. You can store a Context value anywhere, and retrieve it from anywhere afterwards.
ยง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();