By Joseph Savona·
Today we’re excited to share an update on Relay - the technical preview is now open-source and available on GitHub.
While React simplified the process of developing complex user-interfaces, it left open the question of how to interact with data on the server. It turns out that this was a significant source of friction for our developers; fragile coupling between client and server caused data-related bugs and made iteration harder. Furthermore, developers were forced to constantly re-implement complex async logic instead of focusing on their apps. Relay addresses these concerns by borrowing important lessons from React: it provides declarative, component-oriented data fetching for React applications.
Declarative data-fetching means that Relay applications specify what data they need, not how to fetch that data. Just as React uses a description of the desired UI to manage view updates, Relay uses a data description in the form of GraphQL queries. Given these descriptions, Relay coalesces queries into batches for efficiency, manages error-prone asynchronous logic, caches data for performance, and automatically updates views as data changes.
Relay is also component-oriented, extending the notion of a React component to include a description of what data is necessary to render it. This collocation allows developers to reason locally about their application and eliminates bugs such as under- or over-fetching data.
Relay is in use at Facebook in production apps, and we’re using it more and more because Relay lets developers focus on their products and move fast. It’s working for us and we’d like to share it with the community.
We’re open-sourcing a technical preview of Relay - the core framework that we use internally, with some modifications for use outside Facebook. As this is the first release, it’s good to keep in mind that there may be some incomplete or missing features. We’ll continue to develop Relay and are working closely with the GraphQL community to ensure that Relay tracks updates during GraphQL’s RFC period. But we couldn’t wait any longer to get this in your hands, and we’re looking forward to your feedback and contributions.
Relay is available on GitHub and npm.
The team is super excited to be releasing Relay - and just as excited about what’s next. Here are some of the things we’ll be focusing on:
Thanks!