Hey Lewis, thanks for reading! and the article actually agrees with you on that one!
This nuances in what should be the use cases for Server Actions are actually the whole point of this article :)
Server Actions are POST-only and can't be natively cached, which makes them a poor fit as soon as your data fetching needs any caching or state management. Something like TanStack Query or SWR will serve you much better there.
On the API route point, the abstraction still meaningfully reduces boilerplate and makes TypeScript types seamless across boundaries. Similar concept under the hood, very different experience in practice.
Very insightful. Thanks for sharing!
Let me know what you think! Can you think of more use cases? What is your favorite way to use server actions?
Lewis
Hmm... You shouldn't use server actions to fetch data, only to mutate it. And some of the other benefits didn't really make sense (e.g. you 'don't have to implement an API route', but you do have to implement a server action, which behind the scenes is an API route, and therefore requires a lot of the same code) This could use more research and an update perhaps :)