Next.js Discord

Discord Forum

NextJS App Directory and Prisma

Unanswered
Ojos Azules posted this in #help-forum
Open in Discord
Ojos AzulesOP
I have this component that i fetch from prisma and display the barber names. But this component should be connected with a component that is client component because the client compnent have the images and links and this component has only the names, but i cant connect component with prisma client in client component. What do you recommend to do for this problem? This is my client component

17 Replies

@Ojos Azules I have this component that i fetch from prisma and display the barber names. But this component should be connected with a component that is client component because the client compnent have the images and links and this component has only the names, but i cant connect component with prisma client in client component. What do you recommend to do for this problem? This is my client component
import PageClient from "./page-client";
export default async function Page() {
  const data = await getData();
  return <PageClient data={data} />;
}

"use client";
export default function PageClient({ data }) {
  // use redux and everything client-side here
  return <div />;
}
Ojos AzulesOP
import prisma from "@/prisma/lib/prisma"; import Team from "../components/Team"; export default async function BarberData() { const barbers = await prisma.barber.findMany(); return ( <Team barbers={barbers} /> ); }
i did this
Its correct?
yes looks correct
Ojos AzulesOP
Nah barbers are undefined on team.tsx
@Ojos Azules
try "use client"; not "use client";
Ojos AzulesOP
i consloe log but doesnt log something
no sorry
undefined
again
But its weird
Because if i add html and run barbers.map(barber) it will dislpay names of barbers
And this is the example
Ojos AzulesOP
I cant understand