pub fn key<K, F, R>(key: K, block: F) -> RExpand description
Groups the execution of a block of code with a stable key.
This is useful for maintaining state identity in dynamic lists or loops where the order of items might change.
ยงExamples
use tessera_ui::{key, remember, tessera};
#[tessera]
fn my_list(items: Vec<String>) {
for item in items.iter() {
key(item.clone(), || {
let state = remember(|| 0);
});
}
}