Maps a stream of events to the state after each step, which is convenient for UI code that only renders the latest state (for example collectAsState in Compose).
collectAsState