A basic implementation of StateRef without React.
Confirms the current state (potentially applying a confirmation transformation).
Returns the current state value.
Updates the state to the provided value.
The new state value.
A basic implementation of StateRef without React.