Why a re-introduction? Because JavaScript is notorious for being misunderstood. It is often derided as being a toy, but beneath its layer of deceptive simplicity, powerful language features await. JavaScript is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an important skill for any web or mobile developer. It's useful to start with an overview of the language's history. JavaScript was created in 1995 by Brendan Eich while he was an engineer at Netscape. JavaScript was first released with Netscape 2 early in 1996. It was originally going to be called LiveScript, but it was renamed in an ill-fated marketing decision that attempted to capitalize on the popularity of Sun Microsystem's Java language — despite the two having very little in common. This has been a source of confusion ever since. Several months later, Microsoft released JScript with Internet Explorer 3. It was a mostly-compatible JavaScri...
How to fetch data from an API using GraphQL in a React App Of course everyone is familiar with REST APIs, but there is another type of API that is becoming increasingly popular and that is the GraphQL API. GraphQL is a data query language for APIs. The significant difference between GraphQL APIs and REST APIs is that in a GraphQL API, we explicitly indicate in our query which specific data we want to fetch and request. In a REST API, we get back all the data from a url endpoint. Thus, GraphQL saves us some time by giving us more control over which data we want to request and receive from the API. The first time I encountered GraphQL was when I was learning how to create a Gatsby.js app; it uses GraphQL to access your app data. I’ve also attended a workshop where I learned how to build a GraphQL API using MongoDB and Node.js. Naturally, the next logical step in my GraphQL expedition would be to use GraphQL with a frontend library like, React. In this blog, ...
Intro This page will walk you through a series of GraphQL queries, each designed to demonstrate a particular feature of GraphQL. These examples will work on the real schema used on graphql-reference example . You can run this example locally to experiment and poke around the innards of the site! To get to the GraphiQL editor, go to localhost:8000/___graphql (that’s three underscores). You can also open the CodeSandbox version of the example site. For more background information, read about why Gatsby uses GraphQL and how to use GraphiQL in any Gatsby site. Basic queries Example: Site metadata Start with the basics, pulling up the site title from your gatsby-config.js ’s siteMetadata . Copy copy code to clipboard { site { siteMetadata { title } } } In the GraphiQL editor, try editing the query to include the description from siteMetadata . When typing in th...
Comments
Post a Comment