select

fun <T : Store<S, *>, S, R> CompositionLocal<T>.select(selector: (S) -> R): State<R>

Extracts a value from the current state of the Store provided by localStoreOf using the selector. Only when the value is changed, the composable will be recomposed.

An example of a composable that displays the current count:

@Composable
fun Counter() {
val count by LocalCounterStore.select { it.count }
Text(text = "Count: $count")
}