ViewModel
Activity·Fragment 회전·재생성에도 상태 보존한다.
class UserViewModel : ViewModel() {
val state = MutableStateFlow(UserState())
}UI 상태를 라이프사이클 변경에도 유지. Jetpack 표준.
Activity·Fragment 회전·재생성에도 상태 보존한다.
class UserViewModel : ViewModel() {
val state = MutableStateFlow(UserState())
}