App Component: Changing Screens
Explore how to build interactive React screens by managing API requests, updating component states, and rendering different views based on game status. Understand binding methods, debugging with console logs, and handling user inputs to create a dynamic gameplay experience.
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 ...