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

Function useMutation

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

Source from the content-addressed store, hash-verified

3
4
5export const useMutation = (arg1: string, arg2: string) => {
6 const context = useContext(URLContext)
7
8 let url = arg1
9 let MUTATION = arg2
10
11 if (arg1 && !arg2 && context.url) {
12 url = context.url
13 MUTATION = arg1
14 }
15
16 const request = useFetch(url)
17
18 const mutate = useCallback(inputs => request.mutate(MUTATION, inputs), [])
19
20 return Object.assign([request.data, request.loading, request.error, mutate], { ...request, mutate })
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…