Answer the question
In order to leave comments, you need to log in
How to use 2 useQuery in one file?
Good afternoon, I use Graphql + Apollo client on react'e. For example, when I have one request in a file, I can arrange it this way
const { loading , data = {} } = useQuery(KINDS)
const { Kinds = [] } = data
// и дальше к примеру
if(!loading){
// code
}
const kindsByRestaraunt = useQuery(KINDS_BY_RESTAURANT, {
variables: { id }
})
if(!kindsByRestaraunt.loading)
console.log(kindsByRestaraunt?.data?.KindsByRestaurant)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question