onLoading

fun <T> State<T>.onLoading(block: @Composable () -> Unit)

Executes the given composable block if the State is State.Loading.

This is a convenience function to simplify conditional rendering based on the state.

Example usage:

val myState: State<String> = ...

myState.onLoading {
CircularProgressIndicator()
}

Parameters

block

The composable block to execute if the state is Loading.