T
TanStack5mo ago
afraid-scarlet

Can I call createServerFn inside another function or does it have to be used in module scope?

Title! This is regarding a helper function I’d like to make. But I understand the compile process probably means it has to be used only at top level. Thanks
4 Replies
deep-jade
deep-jade5mo ago
you can call server functions from another function on the server
afraid-scarlet
afraid-scarletOP5mo ago
I mean can I call createServerFn to … create server functions… inside a helper. Sounds like you’re talking about the result of createServerFn, which yes I know can be called anywhere I just suspect it’s not possible because of the bundling step
deep-jade
deep-jade5mo ago
no you cannot create a server function inside another function
afraid-scarlet
afraid-scarletOP5mo ago
Ok great thanks for confirming, I'll move things around a bit

Did you find this page helpful?