Code for Kata 4 is available in the app4 folder.
The idea here is learn how to add a router to our react app.
You are given an app that lists all redgate products by name.
Write the JavaScript/React code to:
- Navigate to each product page
- Be able to share hard links of any product page
- Install
react-router-dom
- Add
BrowserRouter
to your root component - Create hard links in the
ProductItem
component to link to/products/productName
e.g:/products/ReadyRoll
- Make the
<ProductContainer>
render ONLY when the location changes to a product name. i.e: when the URL islocalhost:3000/products/ReadyRoll
, render<ProductContainer>
. - Show the product name given by the URL in the
<ProductContainer>
- Inside
<ProductContainer>
find the correct product fromdata.produdcts
and display it using the<Product>
component.