T
TanStack•3y ago
optimistic-gold

Use of graphql-upload

Hey, I try to wrap my head around the idea of using the react-query with the graphql-upload (https://www.npmjs.com/package/graphql-upload). What I want to achieve is to use graphql mutations where I will send files (jpg images) as a multipart instead of encoding them as BASE64 strings. I see that ppl tend to use that library but they always use apollo server with it - I don't want to use any apollo on my end, just clean react-query + graphql-request. I guess it's doable and I'm just to stupid to connect the dots 😅 Could someone help me with that? Or maybe already did that and can share some code? Thanks!
1 Reply
eager-peach
eager-peach•3y ago
react-query doesn't handle the API requests part.. so you'd do it like how you'd normally, and pass it along to useMutation hook https://tanstack.com/query/v4/docs/react/reference/useMutation

Did you find this page helpful?