Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You want to execute a single query for a given page for performance. But whether a field is included in the query should depend on whether a component uses that field. If you write the raw query without fragments, you introduce implicit coupling between the query declaration and the subcomponents, which (like with REST endpoints, CSS classes, etc) means the query becomes append-only. Removing fields is dangerous and requires research, which devs on a Friday won’t do. Especially if you’re making changes to a component used across many pages.

Okay, so write fragments. However, without a framework like Relay (and soon Apollo), you still receive, at runtime, the entire network response. ie there is no masking at the fragment level. This means that there still is an implicit dependency between components, and removing fields is still dangerous.

That’s why you need Relay.

I make that case here - https://youtu.be/lhVGdErZuN4?si=tOJNWl-j-Uj28RUs



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: