Book Image

Getting Started with React

By : Doel Sengupta, Manu Singhal, Danillo Corvalan
Book Image

Getting Started with React

By: Doel Sengupta, Manu Singhal, Danillo Corvalan

Overview of this book

ReactJS, popularly known as the V (view) of the MVC architecture, was developed by the Facebook and Instagram developers. It follows a unidirectional data flow, virtual DOM, and DOM difference that are generously leveraged in order to increase the performance of the UI. Getting Started with React will help you implement the Reactive paradigm to build stateless and asynchronous apps with React. We will begin with an overview of ReactJS and its evolution over the years, followed by building a simple React component. We will then build the same react component with JSX syntax to demystify its usage. You will see how to configure the Facebook Graph API, get your likes list, and render it using React. Following this, we will break the UI into components and you’ll learn how to establish communication between them and respond to users input/events in order to have the UI reflect their state. You’ll also get to grips with the ES6 syntaxes. Moving ahead, we will delve into the FLUX and its architecture, which is used to build client-side web applications and complements React’s composable view components by utilizing a unidirectional data flow. Towards the end, you’ll find out how to make your components reusable, and test and deploy them into a production environment. Finally, we’ll briefly touch on other topics such as React on the server side, Redux and some advanced concepts.
Table of Contents (18 chapters)
Getting Started with React
Credits
About the Authors
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Relay and GraphQL


Relay is a framework in ReactJS for declarative data fetching, which solves the problem of updating the data in a React-based application and where exactly it has to be updated. Using GraphQL, the Relay framework decouples what data is to be fetched from how it should be fetched.

GraphQL is like a query language to query a graph though not typically a graph like those represented in pie charts, x, y axes, or Venn diagrams.

  • It's used to query from a relationship graph, where each node and the relationship between them are represented as edges.

  • In order to fetch data from a subset of such a relationship-based graph, GraphQL is very useful.

  • Unlike in representational state transfer (REST) where data is fetched from the server based on server endpoint using resources, in GraphQL data are fetched from the server based on the requirement by the client.

  • Thus, the data is decoupled, and all the data are fetched at one go from the server within a single network request.

  • Data can be stored...