DEV Community

Jamie Barton
Jamie Barton

Posted on

Update index page to use ProductList component

Let's use the newly created ProductList component on our homepage.

Inside src/pages/index.js, import the component:

import ProductList from "../components/ProductList";
Enter fullscreen mode Exit fullscreen mode

Next replace the following:

<pre>{JSON.stringify(products, null, 2)}</pre>
Enter fullscreen mode Exit fullscreen mode

With our new ProductList component, and pass along products as a prop.

<ProductList products={allChecProduct.nodes} />
Enter fullscreen mode Exit fullscreen mode

Discussion (0)