RepositoryRustUSHoa Kỳ
ME

meta/relay

Relay is a JavaScript framework for building data-driven React applications.

19.0ksao
1.9kfork
644issue
6lượt xem

⚛️ Relay: GraphQL data fetching built into React

Declare what you need. Fetch only what matters.

Relay is a JavaScript framework for building data-driven React applications. It uses GraphQL to let components declare their exact data requirements, shifting fetching away from imperative API calls and keeping data logic closer to the UI.

✨ Highlights

  • Declarative fetching: Declare data requirements using GraphQL and let Relay figure out how and when to fetch them.
  • Colocation: Queries live next to the views that rely on them, making apps easier to reason about.
  • Query aggregation: Relay aggregates queries into efficient network requests to fetch only what's needed.
  • GraphQL mutations: Mutate data on client and server with automatic data consistency, optimistic updates, and error handling.
  • Ready-to-try examples: The relay-examples repo includes a working TodoMVC implementation to get started quickly.

💡 Why it matters

Relay cuts down on over-fetching by tying queries directly to components and batching them at the network level. With built-in mutation handling and consistency, it keeps large React apps more predictable without forcing data logic to live far away from the views that use it.


#React #GraphQL #JavaScript #DataFetching #TiniX