Skip to main content

scope_memo

Function scope_memo 

Source
pub fn scope_memo<T: 'static>(key: &str, init: impl FnOnce() -> T) -> Rc<T>
Expand description

Access this scope’s memo cache from anywhere inside a scope! body. Returns the cached value for key, or creates it with init and stores it. The value persists until the scope is disposed.

Unlike remember_with_key, this is scoped to the current composition scope and is automatically cleaned up when the scope is no longer composed.