react-prisma
When react-prisma
package was introduced, it made it easier to use Prisma in React Server Components (RSC).
This approach is not needed anymore, thanks to all the changes that the React Team made in React Server Components since.
Note: At the time of deprecation (August 1st, 2023), RSC are:
- only available in Next.js framework (the App Router must be used).
- coming soon to Redwood.js framework.
Resources on how to use RSC today
- RSC demo repository from the React Team https://github.com/reactjs/server-components-demo
- Example from CoderOne using Prisma in RSC (video + repository)
Legacy README
This package allows using Prisma Client in a React Server Component.
It is a thin wrapper around @prisma/client
.
This is unstable
We don't guarantee that this works. Any moment the underlying react
api can change and break this package.
Known limitations
Right now this package does not support:
- query chaining, like:
prisma.user.findUnique({ where: { id: 42 } }).posts()
- mutations, only
findMany
,findFirst
,findOne
,findUnique
,count
operations are allowed.