Should the state be comprised of only immutable va...
# mvikotlin
n
Should the state be comprised of only immutable values? Currently having a debate over this, as I need to add new values to a map or an array, do I have to copy over the entire array with the added element? I encountered similar issues with React and JS and used Immer library to handle them.
Copy code
data class State(
    val topics: List<String> = listOf(),
    val messages : MutableMap<String, ArrayList<MessageModel>> = mutableMapOf(),
)
Currently doing this for the topics
Copy code
copy(topics = topics.plus(topic))
And what to do about the map So if I wanted to add a new topic or add a new entry to the message map, how would I approach it?