Can I use Drizzle in Nextjs client components?

I create this file.
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const connectionString = process.env.DATABASE_URL_POOL as string;

// Disable prefetch as it is not supported for "Transaction" pool mode
const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

const connectionString = process.env.DATABASE_URL_POOL as string;

// Disable prefetch as it is not supported for "Transaction" pool mode
const client = postgres(connectionString, { prepare: false });
export const db = drizzle(client);
Can I use it in a client component or should I use it in a server action instead and then use the server action inside a client component?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server