Parsing URLs and using their components to modify parts of the app
Having established some working knowledge about how Location
and Link
components work, we want to use this in our app. The plan is to add 169 new pages using three callbacks and adding a few new layout elements. The user will have a drop-down menu of countries to choose from. Selecting a country modifies the URL, which will render the country layout. This layout will include a heading, a chart, and a table about the country in the URL.
Figure 11.2 shows a sample of a country page that we will build:
As you can see, we now have a template for a country page. This was triggered because the URL contained a country that is one of the available countries in the dataset. Otherwise, it will display the main app, containing all the components that we have built so far. Users can also click on the Home...