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! 👍
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.
Do I really need
if (!products) return null;
like in theProductList
component? ..sincegetStaticProps
fetches the props at build time, the component wouldn't have to wait for theproducts
, right? I am a little bit familiar with Next, but not entirely sure..Anyways, thanks alot for the tutorial - to kickstart my shop development! 👍
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 :)
Alright, that makes sense. Thanks a lot!