The name ‘useRef’ really threw me off. It made me think this hook did one thing, when really it does something else entirely. To stop other people getting all confused like I did, I wrote this post explaining exactly what the useRef hook is, and how to use it. In
Why I both hate and love fat arrow functions
When fat arrow functions were first added to JavaScript, I rejoiced. For a language where you often end up writing small functions is place as an argument passed to something, having a concise way to define an anonymous function was really handy. A great example would be the following vs
JavaScript: Using fetch to make HTTP requests
Once upon a time JavaScript was used to add a small sprinkling of interactivity to otherwise static web pages. Times have changed since then. People now expect entire applications delivered in the browser. Applications need data, and the best way to get data to a Frontend app is to make
How to write custom hooks in React
Hooks have been the latest hotness in React for a while now. They come with certain advantages like reducing the need for render props (god thank you!) and being able to have state in function based components. If you haven’t used them yet, I really recommend you check out the
JavaScript: ES6 modules made simple
Before ES6 there was no native system in JavaScript for importing modules. There were tools like commonjs, but nothing built into the language spec. Every other major language seems to have a way to do this, so the fact that JavaScript lacked this did lend credence to the people who
JavaScript: Transforming arrays using map
If you’ve done even the most basic coding in JavaScript, I’m sure at some point you’ve used a for loop to iterate an array. This works just fine, but did you know that Array.prototype (the base array object) contains a number of functions that make performing common tasks based on
5 Reasons You Need To Learn JavaScript This Year
Now is the best and most rewarding time for you to learn JavaScript. I made the decision a few years ago to focus my learning and career efforts towards JavaScript. In this post I’m going to share with you some of the reasons I did that. I think you’ll find
Learning JavaScript By Building Your Own Version Of JQuery – Part 4
If you’ve been following along with all the posts in this series, you should now have your own very cutdown version of JQuery called . You’re now going to add two functions to that: – Finds all direct children of the selector1, filtered by selector2 – Finds all descendants of
Learning JavaScript By Building Your Own Version Of JQuery – Part 3
Last time you built upon the cutdown object you created in Part 1 by adding the ability to add handlers for many event types in a very efficient manner. This time we’ll add our own equivalent of JQuery’s function. Use JSBin to create an HTML document as follows: If you’ve
Learning JavaScript By Building Your Own Version Of JQuery – Part 2
In part one you built a basic copycat JQuery function () with the ability to add handlers for click events. In this post you’ll expand upon this to allow to be used to add handlers for multiple types of event. The code so far should look like so: You won’t