Composing Components
When defining React components, we can use them as the children of another component by using that component as a React element. We already saw this when we included the Catalog
component inside of the App
component, but let's analyze this composition further.
Combining Components
We will now see how to combine components in order to create new, complex components:
- Open the
src/ProductList.js
file in themy-shop-03
folder - Follow the text until the end of the section
Let's consider the following component:
import React from 'react'; class ProductList extends React.Component { render() { return <ul> <li> <h3>Traditional Merlot</h3> <p>A bottle of middle weight wine, lower in tannins (smoother), with a more red-fruited flavor profile.</p> </li> <li> <h3>Classic Chianti</h3> <p>A medium-bodied wine characterized by a marvelous freshness with ...