Refactor Game State to a Single Repeating Broadcaster

InstructorJohn Lindquist

Share this video with your friends

Send Tweet

When combining two broadcasters it also makes sense to output both of the values as a single state object so our operators can have complete control over how the values come through. This saves us from worrying about keeping values in sync especially when we use something like a repeat operator that tells the original broadcaster to cancel and start over. In our scenario, the mapping logic for I game can easily be expressed inside of the JSX If we have both the most recent value of the guess out of the word.