Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JavaScriptures 4.1 - Relay

JavaScriptures 4.1 - Relay

Artsy Open Source

April 11, 2018
Tweet

More Decks by Artsy Open Source

Other Decks in Programming

Transcript

  1. Relay
    Let there be data in the firmament
    JavaScriptures IV.I
    Alloy

    View Slide

  2. Why have an API client at all?

    View Slide

  3. Description
    ● Provide application code with an interface abstracted away from network/API details
    ● Handle authentication in a single place
    ● Handle caching in a single place
    ● Handle errors in a single place
    Responsibilities of an API client

    View Slide

  4. Relay
    A framework for data-driven React apps

    View Slide

  5. Declare the data your components need with GraphQL, Relay determines how and
    when to fetch your data.
    Declarative

    View Slide

  6. GraphQL is written next to the views that rely on them. Relay aggregates queries into
    efficient network requests.
    Colocation

    View Slide

  7. Write GraphQL mutations and Relay offers automatic data consistency, optimistic
    updates, and error handling.
    Mutations

    View Slide

  8. Relay compiler uses your full GraphQL schema at compile-time to ensure the data
    consistency
    Safety

    View Slide

  9. Example

    View Slide

  10. Competitors

    View Slide