Company
Date Published
Author
Alessia Bellisario
Word count
1435
Language
English
Hacker News points
None

Summary

The Apollo Client team has introduced two new features: the `@nonreactive` directive and the `useFragment` hook. The `@nonreactive` directive allows developers to mark specific fields or fragments in a query that should not trigger a re-render if their cached value changes, while the `useFragment` hook enables live binding into the Apollo Client cache for a GraphQL fragment, allowing child components to re-render without needing to re-render the parent. These features can be used together to selectively re-render individual list items by default, eliminating the need for memoization in some cases. By applying the `@nonreactive` directive to fields or fragments on the parent component's query and using the `useFragment` hook with child components, developers can achieve predictable behavior and performance when rendering lists.