Category: JavaScript

JavaScript Testing

JavaScript testing #6. Introduction to End-to-End testing with Cypress

This entry is part 6 of 8 in the JavaScript testing tutorial

So far, we’ve covered quite a lot of different types of tests. Some of them were unit tests or integration tests, where we tested a specific part of our implementation or components working together. In this article, we look into End-to-End testing and perform it using the Cypress framework. The principles of the End to End (E2E) testing The […]

Express JavaScript

JavaScript design patterns #4. Decorators and their implementation in TypeScript

This entry is part 4 of 5 in the JavaScript design patterns

When we are cold, we put on a shirt. If that’s not enough, we put a coat on top. Decorators work similarly. In this article, we discuss the principles of the decorator design pattern and talk about their implementation in TypeScript. We also briefly mention the JavaScript implementation of decorators using Babel. The basics of […]

JavaScript React Testing

JavaScript testing #5. Testing hooks with react-hooks-testing-library and Redux

This entry is part 5 of 8 in the JavaScript testing tutorial

The hooks are an exciting addition to React and undoubtedly one that helps us to separate the logic from the template. Doing so makes the above logic more testable. Unfortunately, testing hooks does not prove to be that straightforward. In this article, we look into how we can deal with it using react-hooks-testing-library. Identifying the tricky […]

JavaScript React

JavaScript design patterns #3. The Facade pattern and applying it to React Hooks

This entry is part 3 of 5 in the JavaScript design patterns

The essential thing when approaching design patterns is to utilize them in a way that improves our codebase. The above means that we sometimes can bend them to fit our needs. The Facade design pattern is commonly associated with object-oriented programming. That doesn’t change the fact that we can take its fundamentals and apply them […]

JavaScript

JavaScript design patterns #2. Factories and their implementation in TypeScript

This entry is part 2 of 5 in the JavaScript design patterns

As discussed in the previous part of this series, there are many design patterns out there. Some of them fit well into the JavaScript language, and they are often used. In this article, we discuss the factory method pattern and show some of its use-cases. We also implement it in TypeScript. There seems to some confusion regarding […]

JavaScript

Exploring the caching in the browser. Clarifying the cache-control header

The performance of our websites is an essential factor to consider. One of the ways to improve it is to cache our resources, and there are many ways to implement it. In this article, we define what caching is and go through the most common approaches. Caching Implementing a cache mechanism means storing a copy of […]

JavaScript React

Understanding the useEffect hook in React. Designing custom hooks

Hooks are quite a new feature in React. They seem to simplify how we add logic to our components. When I was starting to use them, most of them seemed straightforward. That didn’t apply to the useEffect hook. It might not be that uncomplicated, and therefore, it needs more explanation. In this article, we look into […]