i want render diff view with data but when use state it not change
like this:
Copy code
val state: MutableList<String>? by imageList.observeAsState(mutableListOf())
if (state.isNullOrEmpty()) {
feedbackPlaceView(addImgClick)
} else {
state?.forEachIndexed { listIndex, s ->
z
Zach Klippenstein (he/him) [MOD]
08/20/2021, 4:24 AM
It’s usually a red flag if you have a MutableList inside a state object. Are you mutating the list instance itself?
z
zhagnfei
08/20/2021, 6:32 AM
if i want update view with data how to do?
zhagnfei
08/20/2021, 7:15 AM
i know,must use SnapshotStateList
z
Zach Klippenstein (he/him) [MOD]
08/20/2021, 10:05 AM
Either use that, or use an immutable list with a MutableState