0

Have a problem. Has someone integrated gRPC web client with Redux-Toolkit RTK query?

Max
  • 11

1 Answers1

1

You can use libraries that offer you api functions that you have to call with queryFn instead of query.

...
myQuery: builder.query({
  async queryFn(arg){
    try {
      const result = await myApi.someFunction()
      return { data: result }
    } catch (e) {
      return { error: e }
    }
  }
})
phry
  • 35,762
  • 5
  • 67
  • 81
  • Can you recommend a list of any such libraries? – ioan Sep 08 '22 at 10:54
  • @ioan I'm just the author or RTK Query, I haven't used grpc on the client-side. I have heard good things about https://github.com/bufbuild/connect-web but cannot vouch for it. – phry Sep 08 '22 at 14:07