Hey guys, I am using viewmodel in my compose application. I am calling api in my viewModel through
viewModelScope.launch
so when I call in my compose function, should I use any thing else? I am reading Side-effects using LunchEffect and DispoableEffect. Is this neccessary in my composable function? If yes can someone guide me, bcoz I unable to understand this concept. Thanks
Copy code
class MainActivityViewModel(private val resultRepository: ResultRepository) : ViewModel() {
init {
getSportResult()
}
fun getSportResult() {
viewModelScope.launch {
val response = resultRepository.getSportResult()
}
}
}