useProducer

fun <T> ComponentScope.useProducer(initialValue: () -> T, vararg keys: Any?, producer: suspend StateProducerScope<T>.() -> Unit): T

Creates a value that is updatable by a given producer coroutine. Whenever producer updates the value, the component will be re-rendered.

The producer will be re-run whenever the given keys change.

The producer is run in the CoroutineScope specified by getTreeProp.

Return

the latest value given by the producer, or by initialValue.