update
Updates this state value and enqueues a new layout calculation reflecting it to execute in the background.
Uses newValueFunction to update this state value using the previous state value, and enqueues a new layout calculation reflecting it to execute in the background.
newValueFunction receives the current state value and can use it to compute the update: this is useful when there could be other enqueued updates that may not have been applied yet.
For example, if your state update should increment a counter, using the function version of update with count -> count + 1
will allow you to account for updates that are in flight but not yet applied (e.g. if the user has tapped a button triggering the update multiple times in succession).