withNewScope

inline fun <R> ComponentScope.withNewScope(key: Any, block: ComponentScope.() -> R): R

Gives every hook called by block an identity nested under key. Use this when the same source hook call renders several logical items whose order can change. The key must be immutable, stable across renders, and unique among invocations of this withNewScope call site under the same parent scope. Duplicate sibling keys are reported and disambiguated by their order. Two different call sites may use the same key without colliding.

The key is retained with hook state. Prefer a small value object or identifier over a mutable or heavyweight object.