When creating a screen that receives a class as parameter, which is the recommended way to keep that class in the uistate of the viewmodel? I know that I can do it using a LaunchedEffect and a vm.setCustomClass() inside, but seems to be a bad practice.
In my vm I have this uiState which should store that customClass variable:
Copy code
data class DetailsScreenUiState(
val loading: Boolean = false,
val customClass: CustomClass? = null //this should keep the variable received in the screen parameter
)
t
Timo Drick
04/28/2025, 8:51 AM
I also did it like you described. Not sure if it is bad practice. I think it depends how you are using it.