Velocidad de Escape

SOLID principles applied to an application with React

SOLID is an acronym that represents a set of five design principles for writing maintainable and scalable software. These principles were introduced by Robert C. Martin and have become fundamental concepts in object-oriented programming. While React is primarily a library for building user interfaces and doesn't directly map to classical object-oriented programming, you can still apply SOLID principles in a React context, especially when using functional components and hooks. Here's a brief overview of each SOLID principle along with examples in a React context: ## Single Responsibility...

React

ESM VS CJS modules

On Twitter I constantly see discussions of this type, about the advantages, disadvantages, why to use them and why not, etc., so I decided to do some research to get out of my ignorance. ## What are ESM and CJS modules? ESM (ECMAScript Modules) and CJS (CommonJS) modules are two different module systems used in JavaScript. They have some key differences in how they are imported, exported, and executed. Here's a brief comparison between the two. ### Syntax - ESM: ECMAScript modules use import and export statements to define dependencies and export values. The import statement is...

JavaScript

Circular dependency and Dependency injection in JavaScript

Very surely we have all faced a problem of circular dependencies at some point in life, it is not very complex to explain and sometimes it is not very difficult to solve. Circular dependencies occur in JavaScript when two or more modules depend on each other in a way that creates a loop. In other words, Module A depends on Module B, and Module B depends on Module A, resulting in a circular reference. Circular dependencies can lead to various issues and make it difficult to understand and maintain code. When the JavaScript runtime encounters circular dependencies, it may not be able to...

JavaScript

Memory Management in JavaScript and Garbage Collector

<a class="hover:no-underline text-blue underline" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_management" target="_blank" rel="noreferrer">Memory management</a> > Low-level languages like C, have manual memory management primitives such as `malloc()` and `free()`. In contrast, JavaScript automatically allocates memory when objects are created and frees it when they are not used anymore (garbage collection). This automaticity is a potential source of confusion: it can give developers the false impression that they don't need to worry about memory management. The last...

JavaScript