Last active
April 7, 2024 20:08
-
-
Save kenny-io/f0b0845f8e5f3a2d6bea024d7f3e9310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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