Next.js Discord

Discord Forum

server action - use it to purely fetch data?

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
Is there anything wrong with this?

It seems like a nice way of getting a typed response compared to using an API. Use case being say i want to get data from a client component. It seems to work fine but i don't see it recommended anywhere.

For example an action that gets user data from the databse and returns it.

4 Replies

its not recommended anywhere coz its still in alpha
you are free to do so
many of us are also ecstatic with the existence of server actions
one of the downside that i have found is that server action will force a route to become dynamically computed at request time. so it can't work on client components on SSG routes