Menu

JavaScript News

Fetching Data in React using React Async

July 31st, 2019

There will always be delays when handling requests over the network. That’s just part of the deal when it comes to making a request and waiting for a response. That’s why we often make use of a loading spinner to show the user that the expected response is loading. See the Pen ojRMaN by Geoff…

A More Accessible Portals Demo

July 31st, 2019

The point of the <portal> element (behind a flag in Chrome Canary) is that you can preload another whole page (like <iframe>), but then have APIs to animate it to the current page. So “Single Page App”-like functionality (SPA), but natively. I think that’s pretty cool. I’m a fan of JavaScript frameworks in general, when…

Run useEffect Only Once

July 30th, 2019

React has a built-in hook called useEffect. Hooks are used in function components. The Class component comparison to useEffect are the methods componentDidMount, componentDidUpdate, and componentWillUnmount. useEffect will run when the component renders, which might be more times than you think. I feel like I’ve had this come up a dozen times in the past…

What I Like About Vue

July 25th, 2019

Dave Rupert digs into some of his favorite Vue features and one particular issue that he has with React: I’ve come to realize one thing I don’t particularly like about React is jumping into a file, reading the top for the state, jumping to the bottom to find the render function, then following the method…

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…