https://kotlinlang.org logo
#compose
Title
# compose
o

oday

03/03/2023, 2:36 PM
I’m in a pickle, I have this state object that I would like to work with as a state in 1 file without having changes to it reflect outside of this 1 file, where that same state object is being observed for other changes how can I get a copy of it and make that a state as well without having this affect the original object?
val genreTags = filterState?.genreTags?.collectAsState()
i want to have this object be a copy of the one in filterState but just to be worked on in this file alone
i’m wrapping it with remember, but that also makes it affected by whatever i do in the file
Copy code
val genreTags: List<GenreTag>? = filterState?.genreTags?.collectAsState()?.value

val tags = remember { mutableStateOf(genreTags) }
Copy code
val tags = remember { mutableStateOf(filterState?.genreTags?.value) }