- We have the following Route that shows a list of customers:
<Route path="/customers" component={CustomersPage} />
Will the CustomersPage component render when the page is "/customers"?
Yes
- Will the CustomersPage component render when the page is "/customers/24322"?
Yes - We only want the CustomersPage component to render when the path is "/customers". How can we change the attributes on Route to achieve this?
We can use the exact attribute:
<Route exact={true} path="/customers" component={CustomersPage} />
- What would be the Route that could handle the path "/customers/24322"? It should put "24322" in a route parameter called customerId:
<Route exact={true} path="/customers/:customerId" component={CustomerPage} />
- We can then use RouteComponentProps...