Photo by Mick Haupt on Unsplash

Before we get started, keep in mind that the useHistory hook will only work if you are using React 16.8 (released Feb. 2019) or later, and are attempting to implement this inside a component. If that is not the case, see my other article, Using ‘history’ to navigate your React app from outside a component.

If you have done any programming in React, you are probably familiar with basic routing using <Switch>, <Route>, and <Link>. To do this, we import BrowserRouter, HashRouter, MemoryRouter, or NativeRouter from react-router-dom and then wrap our <App /> component in our chosen router within index.js


When you are new to programming Git can be pretty daunting. You may not be comfortable with the command line yet, you don’t know the commands, you might be afraid to enter the wrong command and do irreparable damage to your project (don’t worry, this would be pretty hard to do ;), and how does it even work anyway? How does it miraculously know what code I want to keep? I recently had a friend reach out to me with all of these questions and concerns, so believe me, you aren’t alone! …


In the not so distant past there was only one way to define a variable in JavaScript, and that was with var. However, with the introduction of ES6 two additional ways were added, let and const. Wait…why do we need three different ways to do the same thing? Are there instances where one should be used over another? Well, those are some of the questions that I am going to answer for you in this article. But first, we need to have a little discussion about a concept called scope.

Function-scope vs Block-scope

JavaScript has two different scopes. The first is function-scope, sometimes…


Photo by Mollie Sivaram on Unsplash

When you think of data persistence for your web application, I would be willing to bet that the first thing that comes to mind is cookies. You’re not wrong. Cookies are a very common way to save data within an application. In cases such as authentication when the data needs to be read by the server, they are absolutely the correct choice. However, in most other cases a better tool would be localStorage or sessionStorage.

So what are localStorage and sessionStorage? They are part of the web storage API and are used to store key-value pairs. By and large the…


Image sourced from fullyunderstood.com

Suppose you are presented with the problem of determining if a sorted array of numbers contains a certain value. If the array is short enough you might just be able to visually determine if the wanted value is present. But what if the array is very large? You could simply start at the beginning and check the first element against the desired value and see if they match, and if they don’t, move on to the second, and the third, and the…you get the point. Although this brute force approach may technically work, it would be incredibly inefficient for a…


If you have done any programming in React, you are probably familiar with basic routing using <Switch>, <Route>, and <Link>. To do this, we import BrowserRouter, HashRouter, MemoryRouter, or NativeRouter from react-router-dom and then wrap our <App /> component in our chosen router within index.js. This would look something like this:

import React from 'react';
import ReactDOM from 'react-dom';
import {BrowserRouter} from "react-router";
import App from './App';

ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById('root')
);

Now we have the freedom to use the aforementioned tags anywhere within our application. However, what you may not know is that whenever we use any…


Finding the sum of specific values in a series can be a common interview problem. There are many different forms that an algorithm of this type can take. The one we will be looking at today is the second problem from projecteuler.net, so if you are thinking about working your way through those problems and don’t want any spoilers, you should stop reading for the moment.

The Problem:

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34…

Let me start off by saying that if you aren’t already using chrome as a front-end web developer, you should be! Not only is Chrome the most used internet browser, (chrome has over 62% of the market share with safari coming in second at only 20%), there are also a number of applications called extensions that you can use to customize chrome and add some additional tools to your kit. Here are the top 5 extensions that every front-end developer should be using with chrome:

1: JSON Formatter

JSON Formatter allows you to easily toggle between raw and parsed, or pretty printed, JSON.

Brandon Cantello

I’m a software engineer based in Santa Barbara CA. I enjoy building user centric applications and websites that are as intuitive as they are dynamic.

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