Ankit Shah
12/02/2021, 5:21 PM@Composable
fun FollowInterestsContent(actions: MainActions,viewModel:UserOnboardViewModel){
val coroutinesScope = rememberCoroutineScope()
viewModel.setInterestsList(context)
}
This Returns Suspend function 'setInterestsList' should be called only from a coroutine or another suspend function
Next I tried is
@Composable
fun FollowInterestsContent(actions: MainActions,viewModel:UserOnboardViewModel){
val coroutinesScope = rememberCoroutineScope()
coroutinesScope.launch { viewModel.setInterestsList(context) }
}
This Returns Calls to launch should happen inside a LaunchedEffect and not composition
natario1
12/02/2021, 5:26 PMLaunchedEffect(viewModel) { viewModel.doStuff() }
.Ankit Shah
12/02/2021, 5:29 PM