As you can see in the code, I have two composable functions named Screen and Body. When the state of the showError changes, the body function is also recompose. Does it have any side effect? If yes, how to avoid this recompose.
@Composable
fun Screen(viewModel: ViewModel) {
val state by viewModel.uiState.collectAsState()
if (state.showError) {
Text("sample view")
}
Body(state = state)
}
@Composable
fun Body(state: UiState) {
// todo
}