Menu

JavaScript News

Using GraphQL Playground with Gatsby

July 18th, 2019

I’m assuming most of you have already heard about Gatsby, and at least loosely know that it’s basically a static site generator for React sites. It generally runs like this: Data Sources → Pull data from anywhere. Build → Generate your website with React and GraphQL. Deploy → Send the site to any static site…

A Peek at New Methods Coming to Promises

July 16th, 2019

Promises are one of the most celebrated features introduced to JavaScript. Having a native asynchronous artifact baked right into the language has opened up a new era, changing not only how we write code but also setting up the base for other freat APIs — like fetch! Let’s step back a moment to recap the…

Finally… A Post on Finally in Promises

July 16th, 2019

“When does finally fire in a JavaScript promise?” This is a question I was asked in a recent workshop and I thought I’d write up a little post to clear up any confusion. The answer is, to quote Snape: …always. The basic structure is like this: try { // I’ll try to execute some code…

Build a Chat App Using React Hooks in 100 Lines of Code

July 15th, 2019

So, that’s what we’re going to do in this article. We’re going to see how hooks make our development process easier and faster by building a chat application. Specifically, we are building a chat application using Create React App. While doing so, we will be using a selection of React Hooks to simplify the development…

Types or Tests: Why Not Both?

July 10th, 2019

Every now and then, a debate flares up about the value of typed JavaScript. “Just write more tests!” yell some opponents. “Replace unit tests with types!” scream others. Both are right in some ways, and wrong in others. Twitter affords little room for nuance. But in the space of this article we can try to…

The Many Ways to Include CSS in JavaScript Applications

July 8th, 2019

Welcome to an incredibly controversial topic in the land of front-end development! I’m sure that a majority of you reading this have encountered your fair share of #hotdrama surrounding how CSS should be handled within a JavaScript application. I want to preface this post with a disclaimer: There is no hard and fast rule that…

Prototyping with Angular

June 26th, 2019

Since joining Google a year ago, I’ve been using Angular every day to build realistic, front-end prototypes. I’ve used these prototypes to quickly validate ideas with real users. This has helped my team iterate cheaply and minimize the amount of engineering rework. I wanted to share my experience in hopes of encouraging more designers and…

Getting to Know the useReducer React Hook

June 26th, 2019

useReducer is one of a handful of React hooks that shipped in React 16.7.0. It accepts a reducer function with the application initial state, returns the current application state, then dispatches a function. Here is an example of how it is used; const [state, dispatch] = useReducer(reducer, initialState); What’s the good for? Well, think about…

Try Bazel’s opt-in preview in Angular CLI

June 21st, 2019

In Google we build all our software with a tool called Bazel. We’ve been using it for the past over 12 years to build projects with any size — from small internal apps, to large applications such as Gmail, Google Drive, and Google Cloud Console. Thanks to its properties — hermeticity, parallelism, and incrementality, Bazel enables fast builds, which are…

Managing State in React using Unstated-Next

June 17th, 2019

In a previous post, we saw how to manage state using Unstated. As you might recall, Unstated uses React’s built-in setState to allow you create components that can consume state by subscribing to a provider — like the React’s Context API. Well, we’re going to build off that last post by looking at Unstated Next,…