[][src]Function comp_state::memo::use_memo

pub fn use_memo<T: 'static + Clone, F: Fn() -> T>(
    recalc: bool,
    func: F
) -> (T, MemoControl)

use_memo hook - accepts a bool that triggers re-evaluation of the given function. if the bool is true the given function is re-called.

This function also returns a MemoControl struct that has its own recalc method

use_memo can be used in conjunction with watch to trigger re-evaluations on change of watched variables.

Example:

let rendered_list =  use_memo(
    watch(list),
    || expensive_render(list)
)