Defining Convex functions
Could someone explain why the Convex functions have to return a function rather than returns the value directly? Asking for a friend.
3 Replies
Hey! I'm not sure I totally follow. Pulling an example from our quickstart (https://docs.convex.dev/quickstart), defining a Convex function looks like:
Here,
query
is signifying that we're writing a query function. Inside of it, we're just writing an async JavaScript function that takes in the database (db
) and returns the results.
So the thing we are returning is just the array of results (not a function). Does that make sense?Are you asking about the
ConvexHttpClient
?Hi Alex sorry for the late response. Yes, I think my brain just completely forgot JavaScript arrow syntax for some reason. It's just a function. 🤦♂️
No I meant regular Convex mutations and queries.