Cookies
Cookies
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Cookies on 2/13/2024 in #questions
Understanding When To Use Server Actions
As a newer next.js dev it is a little bit overwhelming all the different ways to fetch data for your app. When should I be using server actions over calling an API route. I keep seeing random post and videos essentially saying you can move away from TRPC or API routes with server actions. I tried using a server action to pull data for a dashboard I was creating but got an error saying server actions cannot be utilized on initial render. Can someone help me understand the best use cases and advantages of one over the others.
10 replies