Why should I use Apollo/Relay over urql? [closed]
I’m working on the application that uses GraphQL. I’m using
urql GraphQL client and really like it so far. What are the advantages of using Apollo/Relay over
Core contributor of urql here. Probably a late reply, but better than never
There are distinct advantages and disadvantages of using one of the three over the others.
Relay is strict in terms of what it requires from your schema, but that means that it has very easy-to-use patterns for the most common use cases. It’ll help you to set up pagination with little extra code, but overall it does require you to add more boilerplate to an app that may otherwise be quite small.
Apollo is the most popular solution and a good “all arounder”. It has some defaults, which sometimes may seem quirky, but aim to solve the 99% use-case—so to speak. It comes with a generic normalised cache built-in, which can be applied to any API, and allows you to specify exceptions to its normal caching logic (cache updates) with your mutations.
urql is the newest library and aims to be easy to use, small and customisable. It doesn’t come with normalised caching out of the box, like Apollo or Relay does, but that can be added on separately. While the API is simple, it does allow for deep customisation, which is a double-edged sword: You can likely workaround unexpected problems and code solutions for your specific API, but it may require you to learn about urql’s “Exchanges” later on.
There’s also a longer section on “urql vs Relay vs Apollo” on the How to GraphQL site: https://www.howtographql.com/react-urql/0-introduction/
Hope this helps and isn’t too biased!