Next.js Discord

Discord Forum

downloading data on the server component vs downloading on the client fetch to api

Unanswered
Gouty oak gall posted this in #help-forum
Open in Discord
Gouty oak gallOP
I wonder what will be better:
const ProductsPage = async () => {
  const products = await prisma.product.findMany()
  <And render client component with props />

or
const ProductsPage = () => {
  const products = prisma.product.findMany()
  <And render client component with props and use React.use />

or
on the client component, perform a fetch to the API, where I retrieve and return products

or use the Redux toolkit to fetch from the API?

4 Replies

Gouty oak gallOP
dynamic
American Sable
i would say use a server component for the prisma find and all that. then request your api in a client component
then can setup redux toolkit if you need caching and such