Hello! I'm currently really struggling with how to...
# compose
a
Hello! I'm currently really struggling with how to properly manage state in Compose. For example, I currently have this code below:
Copy code
data class PointPath(
    val pathPoints: List<PathPoint>,
) {
    fun smoothPath(): PointPath { ... }
}
I made the data class immutable since recompositing isn't triggered when the list is updated and made it so anything that modifies it returns a copy (ex.
smoothPath
). However, this feels very cumbersome since I need to manually update the state with the returned copy. Is there a more effective way to do this, especially when it comes to handling the state when object properties change?
s
Either turn the List into one backed with state objects by using
mutableStateListOf
, or just do a
.copy
on your object each time it changes, I think those are your options