In this section, we are going to define a Route component for navigating to the question page. This will contain a variable called questionId at the end of the path, so we will need to use what is called a route parameter. We'll implement more of the question page content in this section as well.
Using route parameters
Adding the question page route
Let's carry out the following steps to add the question page route:
- In App.tsx, import the QuestionPage component we created earlier in this chapter:
import { QuestionPage } from './QuestionPage';
- In the App component's JSX, add a Route component for navigation to the question page:
<Switch>
<Redirect from="/home" to="/"...