App Component: Changing Screens
Explore how to build dynamic React screens by managing multiple API calls, updating application state, and rendering components based on game status. Understand how to bind component methods and handle user input to create an interactive gaming interface within the React client.
We'll cover the following...
We require two calls to the API. This is a side-effect of how the API was designed. In particular, a newly created game only returns the game ID and doesn’t give the other information needed to populate the game-playing screen. This is simply addressed here by making a second request from the API.
Changing the application screen
Now, when a name and language are chosen, the screen changes to state that the game status is active. This leads to the next step, where we deploy the `PlayScreen. We must include the import for the second screen. We add these one at a time to avoid an error ...