Props
So, this all looks good. However, in reality, since we have multiple products and not just one, we need a list of Card components, and not just one. It doesn't make sense to hardcode this component multiple times to correspond to each product. So, instead, we want to write the card component once. The CardContainer component we discussed in the React application design section should pass the product information to the Card component. So, we basically have a parent component that needs to pass some information to a child component.
You might wonder: why do we need the CardContainer component to pass data to the Card component, and not have the Card component look for its own data? The answer is simple: it was found that the best design ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access