useState
Makes the current State available in action. The state is guaranteed not to change during the execution of action. This operation ensures atomic state observations, so the state will not change while the action is being executed.
This method uses a separate coroutineScope, meaning it will suspend until all child Jobs are completed, including those that asynchronously call this method itself (however a different state might be current at that point).
Return
Parameters
Result
the type of the result to be returned
action
the function for which will State receive the state, guaranteed to be unchanged for the duration of the function.