Shop component 

The Shop component will render the shop details and also a list of products in the specified shop using a product list component, which will be discussed in the Products section:

The Shop component can be accessed in the browser at the /shops/:shopId route, which is defined in MainRouter as follows.

mern-marketplace/client/MainRouter.js:

<Route path="/shops/:shopId" component={Shop}/>

In componentDidMount, the shop details are fetched using the read method from api-shop.js.

mern-marketplace/client/shop/Shop.js:

componentDidMount = () => {    read({      shopId: this.match.params.shopId    }).then((data) => {      if (data.error) { this.setState({error: ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.