Best way to fetch, create and update data in Next.js 13 App router

What is the most typesafe way to fetch or mutate data? Should I use route handlers to create my own api? Should I use server actions? Would you recommend using "pingdotgg/zact" for server actions? I'm just curios but can I use server actions to get data from database?
Solution:
- You run DB queries inside a server component. - zact is not supported, use https://github.com/TheEdoRan/next-safe-action instead...
GitHub
GitHub - TheEdoRan/next-safe-action: Type safe and validated Server...
Type safe and validated Server Actions in your Next.js (App Router) project. - GitHub - TheEdoRan/next-safe-action: Type safe and validated Server Actions in your Next.js (App Router) project.
Jump to solution
2 Replies
Solution
Matvey
Matvey13mo ago
- You run DB queries inside a server component. - zact is not supported, use https://github.com/TheEdoRan/next-safe-action instead
GitHub
GitHub - TheEdoRan/next-safe-action: Type safe and validated Server...
Type safe and validated Server Actions in your Next.js (App Router) project. - GitHub - TheEdoRan/next-safe-action: Type safe and validated Server Actions in your Next.js (App Router) project.
ATOMowy_grzyb
ATOMowy_grzyb13mo ago
trpc?
Want results from more Discord servers?
Add your server