Next.js Discord

Discord Forum

Can we write such code in next?

Answered
New Zealand posted this in #help-forum
Open in Discord
New ZealandOP
/component/actions.ts
'use server'
function foo {...}


/app/api/some-get.ts
function GET()  {
    ...
    foo()
    ...
}
Answered by B33fb0n3
yes, the server action then would be translated to a normal function
View full answer

2 Replies

@New Zealand js /component/actions.ts 'use server' function foo {...} /app/api/some-get.ts function GET() { ... foo() ... }
yes, the server action then would be translated to a normal function
Answer