DEV Community

[Comment from a deleted post]
Collapse
 
christiankozalla profile image
Christian Kozalla

Do I really need if (!products) return null; like in the ProductList component? ..since getStaticProps fetches the props at build time, the component wouldn't have to wait for the products , right? I am a little bit familiar with Next, but not entirely sure..

Anyways, thanks alot for the tutorial - to kickstart my shop development! 👍

Collapse
 
notrab profile image
Jamie Barton

To be honest this should be something more like if (products.length === 0) return null.

Basically all I'm doing here is making it so the component doesn't fail if no products are returned from Commerce.js - this hasn't really anything to do with SSR since it would fail there if products was undefined in its current state.

I hope that helps :)

Collapse
 
christiankozalla profile image
Christian Kozalla

Alright, that makes sense. Thanks a lot!