Source: https://pirates.fandom.com/wiki/James_Hook

If you’re a React engineer and you haven’t been living on the moon for the past nine months, chances are you’ve heard about React Hooks. The TL;DR is that before Hooks, class components were the only components that could track state and make requests to an API. Hooks are functions that enable us to use state and other React features in functional components. In this post, I’m going to walk you through four of the major Hooks — useState, useEffect, useContext, and useReducer — , all while refactoring the PhotoFinder app I built to go along with my 2018 post…


Flex your Flexbox muscles!

Responsive design got you down? Tired of guessing about Flexbox properties? Follow these simple steps and you’ll never have to copy and paste Flexbox code again.

Step 1: Is Flexbox right for you?

Flexbox is an effective and easy-to-use CSS module for styling HTML elements inside of a parent so that they respond to changes in browser size. This responsiveness is accomplished by setting a variety of properties on both the parent (known as the flex container) and the children (known as the flex items). …


When it comes to operating on arrays, .splice() and .slice() are two incredibly useful methods to have in your toolkit. It’s not always easy, though, to remember which is which. I’ve put together this crash course on the ins-and-outs of each so that you can start splicing and slicing with confidence. I’ve also included two solutions to the common chunking algorithm: one makes use of .splice(), and the other makes use of .slice().

Onwards!

.splice()

The .splice() method is a destructive array method, which means it modifies the array on which it is called (disclaimer: destructive methods can be risky, especially…


If you’re new to JavaScript, it can be tempting to fasten your seat belt, step on the gas, and careen through the language as quickly as possible. “There’s so much to learn,” you may think to yourself, “so I need to just push on, even if certain fundamentals aren’t quite clear.” While it is, indeed, important to have real breadth to your understanding of JavaScript, it’s also essential that your knowledge have a strong foundation. …


Welcome to the party!

So, you’ve decided to learn React.js. Congratulations! This guide is intended to help you in your quest to understand four fundamental aspects of this incredibly powerful library. We will be building a very simple React app along the way that allows a user to enter a search term and retrieve a list of photographs that match this term from the Unsplash API. Let’s dive in.

Components

Components are the building blocks of every React application. A component can be used on its own, or it can be combined with other components to create even larger components. Crucially, components are dynamic: they…


When we create JavaScript objects, we typically associate them with certain behavior. Consider the below example:

We’ve created a class Dog with three properties and two methods, one of which is tellUsAboutYourSelf(). We’ve also created a new instance of Dog, which is saved into the variable fido. Pretty straightforward. Now, let’s create another class and instantiate a new instance:

We’ve created a Cat object with the same properties as our Dog object, but our instance of Cat, which is saved into the variable sparkles, isn’t able to tell us about itself. We could refactor our code so that…


You know the old saying: Everything in Ruby is an Object. But what does that mean? Where do these Objects come from, and why do they behave the way they do?

Objects come from classes, which you can think of as the blueprints for individual objects — they define the behavior of each and every instance of that particular class. But in order to fully understand the Object-Oriented nature of the Ruby language, it’s essential that you understand object hierarchy: namely, that every instance of a particular class inherits properties and behaviors from its ancestors. …


Source: https://i1.wp.com/altereddimensions.net/main/wp-content/uploads/2016/09/image-36.png

I just completed my second week of the Software Engineering Immersive at Flatiron School, and I’m going to unpack the difference between .sort and .sort_by in Ruby. I first ran into .sort_by when working on the final lab in the pre-work for my program. The lab was called “Alphabetize in Esperanto,” referring to the international auxiliary language known as Esperanto. The challenge? To write a method that accepts an array of strings and sorts them alphabetically according to the Esperanto alphabet. I solved the lab using .sort_by, but even so, I was still unsure of how .sort_by works “under the…

Betsy Sallee

front end engineer / poet / editor / www.betsysallee.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store