Erdem
03/16/2021, 3:54 PMval (state, setState) = useState(emptyList<Post>())
provider.observePosts { list -> setState(list) }
With this method the ui only updates once, however if I set state like this setState(list.toList())
it works fine.
I am concerning about performance. How should I update my list?Marc Knaup
03/16/2021, 4:33 PMMutableList
instance then the state
will change from emptyList()
to your MutableList
and then always stays the same.
I’m not sure if React compares old and new state and optimizes, but if it does it uses ===
.