Skip to content

Instantly share code, notes, and snippets.

@kenny-io
Last active April 7, 2024 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenny-io/f0b0845f8e5f3a2d6bea024d7f3e9310 to your computer and use it in GitHub Desktop.
Save kenny-io/f0b0845f8e5f3a2d6bea024d7f3e9310 to your computer and use it in GitHub Desktop.
import { lazy, Suspense } from 'react';
const ProductDetails = lazy(() => import('./ProductDetails'));
function ProductListing({ products }) {
return (
<Suspense fallback={<div>Loading...</div>}>
<ul>
{products.map((product) => (
<li key={product.id}>
<ProductDetails product={product} />
</li>
))}
</ul>
</Suspense>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment