Why should I use Apollo/Relay over urql? [closed]
Asked Answered
F

1

31

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 urlql?

Foretoken answered 17/7, 2019 at 22:59 Comment(0)
B
64

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!

Babin answered 10/9, 2019 at 0:32 Comment(2)
thanks for your comment, I am a newbie in terms of web, can you please explain a bit about normalized caching ? I just checked urql documentation and it supports caching, but what does it mean by cache normalization ?Modesta
@ZarghamKhan It refers to caching "normalized data"... formidable.com/open-source/urql/docs/graphcache/…Fugger

© 2022 - 2024 — McMap. All rights reserved.