React Query Provider for Redwood

Hey All!

I’m a big fan of react-query and was hoping to use it in a new Redwood project but still keep the Cell functionality. The other night @peterp mentioned that it is possible to swap out Apollo for whatever GraphQL client you want.

So I spent some time and got react-query + graphql-request working as a replacement!

I put together a package for anyone else out there that wants to do the same. Hopefully you find it as useful as I have :rocket:

6 Likes

This is fantastic @marceloalves :rocket: Thanks for posting! We’ll blast this out on the Redwood Twitter account as well.

So. Good.

1 Like

Amazing work Marcelo, and welcome to the community! I’ve been waiting for something like this since Peter first mentioned swapping out the RW Client last summer. This has inspired a few people (myself included) to pick up React Query and play around with it a little bit, both with and without Redwood.

1 Like

Open question to the community, has anyone tried swapping out the client, yet?

I’d be curious to know about anyone’s experience as I’m currently experimenting heavily with the same combination of libraries (graphql-request and react-query).

I know at least @Chris and @dom have implemented it.

I’m running it in one of my projects. But I’m not sure it’s the best implementation. There’s a discussion started by Tanner over at the react-query GH repo about using react-query with graphql-request. The top post there has an implementation that’s much more advanced than the one I’m using. So I’m guessing there’s something I’m missing…

1 Like

Yes, this is the exact thing I needed from the internet right now.