sycamore::reactive

Function use_context_or_else

pub fn use_context_or_else<T, F>(f: F) -> T
where T: Clone + 'static, F: FnOnce() -> T,
Expand description

Try to get a context with the given type. If no context is found, returns the value of the function and sets the value of the context in the current scope.