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 ...

Get Hands-On Full Stack Development with Go 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.