MCPcopy Create free account
hub / github.com/ava/use-http / useQuery

Function useQuery

src/useQuery.ts:5–21  ·  view source on GitHub ↗
(arg1: string, arg2: string)

Source from the content-addressed store, hash-verified

3
4
5export const useQuery = (arg1: string, arg2: string) => {
6 const context = useContext(URLContext)
7
8 let url = arg1
9 let QUERY = arg2
10
11 if (arg1 && !arg2 && context.url) {
12 url = context.url
13 QUERY = arg1
14 }
15
16 const request = useFetch(url)
17
18 const query = useCallback(inputs => request.query(QUERY, inputs), [])
19
20 return Object.assign([request.data, request.loading, request.error, query], { ...request, query })
21}

Callers

nothing calls this directly

Calls 1

useFetchFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…