Skip to Main Content
Next.js Quick Start Guide
book

Next.js Quick Start Guide

by Kirill Konshin
July 2018
Intermediate to advanced content levelIntermediate to advanced
164 pages
3h 15m
English
Packt Publishing
Content preview from Next.js Quick Start Guide

Using GraphQL with Next.js to fetch data

In this chapter, we will learn how to use basic GraphQL with the Relay framework. But first, let's briefly talk about why GraphQL was introduced and what issues it solves.

When dealing with REST APIs, it is quite common to make some subsequent requests, for example, to get some entities and then for those entities get more sub-entities. By definition, REST endpoints should only provide one type of entity, and any thing else should be fetched from other endpoints, either by following HATEOAS links or by manually creating sub-requests. This increases the amount of network traffic, which forces all clients to re-implement logic for which sub-entities should be fetched and how, and badly affects the 

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Create React App 2 Quick Start Guide

Create React App 2 Quick Start Guide

Brandon Richey
React Cookbook

React Cookbook

David Griffiths, Dawn Griffiths
Test-Driven React

Test-Driven React

Trevor Burnham

Publisher Resources

ISBN: 9781788993661Supplemental Content