Hooks are a buzz in React right now, but what exactly are they, and why are they beneficial to us?
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class.
That’s pretty powerful stuff. We used to be confined to class components whenever we needed to use
componentDidMount anywhere in our applications. React Hooks eliminate the need for class components. Let’s think critically about why this could be important? Have you ever written out a beautiful functional component that has a load of branching logic and realize that in order for it to do the thing it is meant to do you need the state to make it come to life? Have you ever felt personally attacked when refactoring a component and all of its UI and logic from a stateless functional component to a class component just to do something simple like toggle a display class on a node? Have you spent ages planning out your component hierarchy because you feared either of the scenarios above? …
n-Notation & Big O
In computer science, we need a way to be able to compare algorithms to each other. Comparison allows us to see which algorithm is more efficient and we love efficiency. Run times of different programs are usually written in n-Notation. So if we want to look up how fast a certain algorithm is, we will need to know this notation to be able to understand it. But what exactly is it?
n-Notation is represented as a function of n. All this means is that the program is going to be related to that variable “n” in some way. …
Hi everyone, this is part two in a series of blogs I am doing on Sass. If you haven’t read the first one and need help getting started with Sass please feel free to read my first blog, here. In this blog, I will be covering class naming conventions using the BEM, nesting in Sass, and Sass Variables.
The BEM is a methodology aimed at decreasing the footprint left by CSS. That is, CSS code can get really unorganized and hard to read. The BEM is a way that structures your naming conventions to increase readability and functionality. This is super important as it helps other programmers who are reading your code to understand just what is styling what. …
Let’s look at a real-world example, let’s say you have an application that allows you to view your blogs, your profile page, and your drafts. Each of those pages is a different view of the same SPA (single page application). With Client-Side routing, you’ll get the data you need to be able to render all of those pages on the first-page load. …
General Overview, Installation & Setup
I plan to do a series of blogs each week on setting up Sass in your next project. Sass is an awesome tool that compiles all of your CSS for you. It’s really quite magical and allows you to create variables and other goodies so you can keep your code DRY. Huge plus. It is also a great way to keep things organized so you can easily find code and make changes whenever necessary. Sass is “CSS with superpowers” after all.
CSS gets very messy, very quickly. Having a single CSS file with thousands of lines of code without any reusable pieces, without any logic, gets completely unmanageable after some time. That’s why we use Sass. Sass provides us with a couple of handy features and tools that CSS just doesn’t have, like variables or mixins (more on these later). Sass doesn’t change the way CSS works however, it just allows us to be more DRY and consistent with our code. So, putting it in very simple terms, Sass is a CSS preprocessor that adds a lot of power and elegance to the basic language. …
React’s state is data that is changed inside your components. That is, you set a default value and you can change it depending on which component you send the information to or what you decide to do with it. …
let newVariable = 'I am an initialized variable now';
Declared variables (variables with values not yet initialized) are defaulted to
Validations are essential to a Rails application. They allow us to control the information that is being saved into our database. They are given to us through Active Record and allow us to be thoughtful about how we save data. There are many ways that you can control database information. You can use client-side validations and controller-level validations, but the Rails team favors model-level validations for a multitude of reasons. They are database agnostic, meaning that they can be used with various systems and are not customized for a single system. They cannot be bypassed by users. …