Skip to content

Instantly share code, notes, and snippets.

@greim
Last active November 11, 2017 16:47
Show Gist options
  • Save greim/5d7871cb134c71f69a76ee8ca39b6218 to your computer and use it in GitHub Desktop.
Save greim/5d7871cb134c71f69a76ee8ca39b6218 to your computer and use it in GitHub Desktop.
Fetch Logic 2
function ProductDetailPage({ viewportWidth, relatedProductInfo }) {
const hasRealestate = viewportWidth > 800;
const hasData = relatedProductInfo === undefined;
return <div>
...
{ hasRealestate &&
( hasData
? <RelatedProducts products={relatedProducts}/>
: <div data-vacancy={`relatedProducts/${id}`}>Loading...</div>
)
}
</div>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment