the_jozikaT
Convex Community7mo ago
21 replies
the_jozika

useQuery Error Handling in Custom hook

How am i supposed to handle an error from useQuery in a custom hook?

something like this

const useZ = (id:someUserGivenId | undefined) => {
const y = useQuery(api...., {id as Id<'mytable'> | undefined})
///some code i really would not want to have in my component with other hooks
return z
}

this throws an error if the id is not valid. and i would love to handle it inside of this hook. is that somehow possible=
Was this page helpful?