arrow_back Debugging JS - Leveraging the power of Browser Dev Tools
Why GraphQL: A React Developer's Perspective
Submitted by Praveen Durairaj (@praveenweb) on Tuesday, 3 April 2018
Technical level: Intermediate
The hype around “GraphQL is better than REST” can be justified purely by the amount of tooling around it. With code generation, query validation, editor autocomplete coupled with an API Explorer, the life of a frontend developer has never been easier. This talk will explore Why GraphQL is awesome from a React developers perspective!
Before we go deep into
Why GraphQL and how it makes the life of a React developer easy, we will have a brief of what it is:
GraphQL is a query language that allows you to describe your data requirements in a declarative way. The shape of your request matches the shape of the response. The endpoint is always the same (Whaaat!). Let that sink in. I already feel that’s less code to be written. GraphQL is not just a tool, its a standard.
By leveraging the type system, GraphQL makes it easy to work with developer tools enhancing productivity. In a typical REST API integration with your frontend, most of the following isn’t straightforward or not possible at all.
API Explorer (GraphiQL)
Reduced Boilerplate for State Management
With caching and relay/apollo client’s state management, there’s so much less boilerplate code that needs to be written. You probably can get away without using Redux. It’s all intuitive with better handling of state.
As product requirements change, the frontend developer is less tied to the backend team for changing what data they want to display on the UI, unless there is a schema change required.
I’m an Application Engineer at Hasura, with areas of interest spanning around React, Node.js, Python, PostgreSQL, Docker, Kubernetes.