Cómo hacer que Prettier no formatee códigoPrettier nos ayuda entre otras cosas a que nuestro código quede visualmente ordenado y homogéneo. No obstante hay ocasiones donde puede que queramos que Prettier no formatee nuestro código. Por ejemplo, imaginemos que tenemos un código en formato JSO...Jun 2, 2023 · 2 min readblog.mariobarcelo.dev
Hello World con ReactVamos a aprender cómo mostrar un "Hello World" con React. // 1. Importamos dependencias import React from 'react'; import { createRoot } from 'react-dom/client'; // 2. Creamos un elemento de React const element = React.createElement( 'p', { id: ...May 3, 2023 · 1 min readblog.mariobarcelo.dev
How to check if an array includes a valueTo easily know if an array includes a value we can use the includes() method: let items = [ "Computer", "Monitor" ]; items.includes("computer"); // false items.includes("Computer"); // true As you can see it is case sensitive. And you can check fo...Dec 12, 2022 · 1 min readblog.mariobarcelo.dev
Array destructuring in JavaScriptWhen we have an array and we want to extract the variables we can do it like this: const fruits = ['apple', 'strawberry', 'banana', 'orange']; const apple = fruits[0] // apple const strawberry = fruits[1] // strawberry const banana = fruits[2] // ...Dec 8, 2022 · 2 min readblog.mariobarcelo.dev
Create an array and fill it at the same time in JavaScriptTo create an array and fill it at the same time we'll create an Array instance and then we'll use the fill() method. For example: const myNumbers = Array(4).fill(0) // [ 0, 0, 0, 0 ] We place as a parameter to fill() the value we want to place insid...Nov 28, 2022 · 1 min readblog.mariobarcelo.dev