Skip to content

Commit e531238

Browse files
committed
docs: fix: correct variable usage in shared extension example
1 parent 6e0363f commit e531238

File tree

1 file changed

+4
-3
lines changed
  • content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions

1 file changed

+4
-3
lines changed

content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ To import the `find-or-create` extension from the example above, and wrap your c
3030
```ts
3131
import findOrCreate from 'prisma-extension-find-or-create'
3232

33-
const prisma = new PrismaClient().$extends(findOrCreate)
34-
const user = await prisma.user.findOrCreate()
33+
const prisma = new PrismaClient()
34+
const xprisma = prisma.$extends(findOrCreate)
35+
const user = await xprisma.user.findOrCreate()
3536
```
3637

37-
When you call a method in an extension, use the constant name from your `$extends` statement, not `prisma`. In the above example,`xprisma.user.findOrCreate` works, but `prisma.user.findOrCreate` does not, because the original `prisma` is not modified.
38+
When you call a method in an extension, use the constant name from your `$extends` statement, not `prisma`. In the above example, `xprisma.user.findOrCreate` works, but `prisma.user.findOrCreate` does not, because the original `prisma` is not modified.
3839

3940
## Create a shareable extension
4041

0 commit comments

Comments
 (0)