T
TanStack2mo ago
national-gold

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
stormy-gold
stormy-gold2mo ago
you can call server functions from another function on the server
national-gold
national-goldOP2mo 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
stormy-gold
stormy-gold2mo ago
no you cannot create a server function inside another function
national-gold
national-goldOP2mo ago
Ok great thanks for confirming, I'll move things around a bit

Did you find this page helpful?