logoalt Hacker News

tcoff91 • today at 8:39 AM • 0 replies • view on HN

The main benefit in my experience is normalized caching and optimistic state. You execute a mutation, you receive back the updated entity, the normalized cache rerenders all the components that are selecting the updated fields on that entity and your whole app’s UI just stays in sync. I haven’t used Relay but URQL is nice.

But yes, declaring component data needs via fragments is great and then you build the query document by combining the fragments so you only fetch what your UI needs. You can really make your app perform well on high-latency mobile networks by reducing the amount of round trips. You don’t need GraphQL to do that per se but it helps.