jamalsoueidan
jamalsoueidan4mo ago

create a method to query on demand?

how do i create a action method that can query the database on demand to be used on the frontend, i tried to use internalquery with a action, but the action didnt allow me to return the internal query? I need to use it in the frontend on demand...
3 Replies
jamalsoueidan
jamalsoueidanOP4mo ago
const search = useQuery(api.xxx.xxx); // later search('xxx')
jamwt
jamwt4mo ago
const convex = useConvex();
// later
const result = await convex.query('xxx');
const convex = useConvex();
// later
const result = await convex.query('xxx');
these are "one-shot queries"
jamalsoueidan
jamalsoueidanOP4mo ago
nice thank you