Features
Debugging a resource

Debugging a resource

You can use useDebug to log a query in the console when it's updated.

useDebug(query, label)

Example

function useFetchAndDebugMixture(query: Query, label: string) {
  useFetch(query)
  useDebug(query, label)
}
 
function useHelloMix() {
  const query = useSchema(getHelloSchema, [])
  useFetchAndDebugMixture(query, label)
  return query
}

Implementation

export function useDebug(
  query: Query,
  label: string
) {
  const { time } = query
 
  useEffect(() => {
    console.debug(label, query)
  }, [time])
}