Chachako
04/29/2021, 4:37 AMrememberUpdatedState applies to? I saw rememberUpdatedState is used in Compose Dialog to remember content, but I still can’t understand what describes in kdoc. Could someone please explain it to me. I am grateful.Albert Chang
04/29/2021, 7:29 AMrememberUpdatedState may help.
@Composable
fun <T> rememberUpdatedState(newValue: T): State<T> = remember {
mutableStateOf(newValue)
}.apply { value = newValue }Albert Chang
04/29/2021, 7:32 AMDialog, I believe it's that the content lambda is executed in another setContent call, which means that the content will not be correctly updated if recomposition is not explicitly triggered by the State.Chachako
04/29/2021, 8:18 AM