Using LiveData as state inside Jetpack @Compose functions

Here is another way to observe live data using state. There is an extension function for this just include it.

add gradle dependency below one:

implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta01'

now just convert your regular LiveData to State for example.

 val breedItems by doggoViewModel.liveBreedData().observeAsState()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)