<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kevin david cuadros</title>
    <description>The latest articles on DEV Community by kevin david cuadros (@cuadroscode).</description>
    <link>https://dev.to/cuadroscode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F684308%2F91e9aaab-26ce-4fa9-927d-dd8d69315a13.jpeg</url>
      <title>DEV Community: kevin david cuadros</title>
      <link>https://dev.to/cuadroscode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cuadroscode"/>
    <language>en</language>
    <item>
      <title>How to Manage State in Astro and Svelte.</title>
      <dc:creator>kevin david cuadros</dc:creator>
      <pubDate>Tue, 10 Oct 2023 03:51:48 +0000</pubDate>
      <link>https://dev.to/cuadroscode/how-to-manage-state-in-astro-and-svelte-jen</link>
      <guid>https://dev.to/cuadroscode/how-to-manage-state-in-astro-and-svelte-jen</guid>
      <description>&lt;p&gt;When creating my first app in Astro and implementing Svelte, I encountered issues with sharing states between the components of my app. Astro, being focused on speed and content-centricity by default, does not maintain state when navigating between pages.&lt;/p&gt;

&lt;p&gt;How do we solve this problem?&lt;/p&gt;

&lt;h2&gt;
  
  
  Implement the store
&lt;/h2&gt;

&lt;p&gt;The first step is to implement the store, and for this, Astro suggests using &lt;a href="https://github.com/nanostores/nanostores" rel="noopener noreferrer"&gt;Nanostores &lt;/a&gt;in its documentation.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install nanostores&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After installing the nanostore dependency, we will implement the store that, for this example, would serve us to manage a user when they authenticate&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the store
&lt;/h2&gt;

&lt;p&gt;To create the store, we will create our file, in this case, we will create it in the path src/store/auth.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihsu8vqzf24aa132o16f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihsu8vqzf24aa132o16f.png" alt="Store auth" width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Maintaining state between navigation
&lt;/h2&gt;

&lt;p&gt;When creating the store, we'll encounter an issue if we want to navigate between pages because Astro, by default, loads the content, which would erase our stored information. How do we solve this?&lt;/p&gt;

&lt;p&gt;To solve this issue, Astro offers a routing component &lt;code&gt;&amp;lt;ViewTransitions /&amp;gt;&lt;/code&gt; that we should add to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of our app. This component, &lt;code&gt;&amp;lt;ViewTransitions /&amp;gt;&lt;/code&gt;, provides us with page transitions without reloading the entire browser's normal navigation.&lt;/p&gt;

&lt;p&gt;For this case, we add it to the Layout component since the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; will be present on all pages of the app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3krpzpr4g49k76fh5q4v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3krpzpr4g49k76fh5q4v.png" alt="Using store" width="800" height="782"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use the state
&lt;/h2&gt;

&lt;p&gt;Having the store and having the &lt;code&gt;&amp;lt;ViewTransitions /&amp;gt;&lt;/code&gt; component in our &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;, we can now use the store without any inconvenience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4phmkye86ymgewx4ch86.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4phmkye86ymgewx4ch86.png" alt="Using store" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here I have an &lt;a href="https://github.com/cuadros-code/any-job" rel="noopener noreferrer"&gt;app &lt;/a&gt;in progress, any questions are welcome.&lt;/p&gt;

&lt;p&gt;My page &lt;a href="https://kevincuadros.com/" rel="noopener noreferrer"&gt;https://kevincuadros.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>astro</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Rust desde cero (parte 1)</title>
      <dc:creator>kevin david cuadros</dc:creator>
      <pubDate>Mon, 29 Aug 2022 15:31:00 +0000</pubDate>
      <link>https://dev.to/cuadroscode/rust-desde-cero-parte-1-9fe</link>
      <guid>https://dev.to/cuadroscode/rust-desde-cero-parte-1-9fe</guid>
      <description>&lt;h2&gt;
  
  
  Este documento contiene los principios mas básicos del lenguaje de programación Rust.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Tabla de contenido
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Imprimir en consola&lt;/li&gt;
&lt;li&gt;Comentarios&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Imprimir en consola
&lt;/h2&gt;



&lt;h4&gt;
  
  
  Single placeholder
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;el single placeholder es utilizado cuando se quiere imprimir un valor único.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqarf5uajw5srp5asytmc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqarf5uajw5srp5asytmc.png" alt="Single Placeholder" width="563" height="140"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn main() {
    println!("Number: {}", 1);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Multiple placeholders
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;podemos usar múltiples placeholders dentro de la macro &lt;strong&gt;println!()&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;el número de placeholders debe ser igual el número de valores a imprimir.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn main() {
    println!("{} con {} company", "Aprendiendo", "Cuadros");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Argumentos posicionales
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;los argumentos posicionales especifica la posición de los valores en la macro.&lt;/li&gt;
&lt;li&gt;la lista de valores puede tener cualquier orden.&lt;/li&gt;
&lt;li&gt;un valor puede ser utilizado cualquier numero de veces.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn main() {
    println!("Enhance your coding skills from {0} courses.  {0} courses are very {1}", "Educative", "interactive");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  Comentarios
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Rust tiene dos maneras de hacer comentarios&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Comentarios en línea
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;para comentar una línea de código debe comenzar por doble slash &lt;strong&gt;//&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Writing a Rust program
fn main() {
    //The line comment is the recommended comment style
    println!("This is a line comment!"); // print hello World to the screen
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Comentario de bloque
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;el texto debe estar encerrado dentro de &lt;code&gt;/*...*/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn main() {
    /* 
    The block comment is extremely useful for temporarily disabling
    a large chunk of code. /* Block comments can also be /* nested, */ */
    To comment a large block just write in between /* text */
    */
    println!("This is a line comment!"); // print hello World to the screen
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>rust</category>
      <category>learn</category>
    </item>
    <item>
      <title>Variables and data types SOLIDITY</title>
      <dc:creator>kevin david cuadros</dc:creator>
      <pubDate>Sat, 09 Apr 2022 17:08:48 +0000</pubDate>
      <link>https://dev.to/cuadroscode/variables-and-data-types-solidity-4n59</link>
      <guid>https://dev.to/cuadroscode/variables-and-data-types-solidity-4n59</guid>
      <description>&lt;h2&gt;
  
  
  VARIABLES
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Global variables
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;msg&lt;/code&gt; Every transaction is a signed message. In this object comes the data of said message (sender, value, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tx&lt;/code&gt; values related to the current transaction&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;block&lt;/code&gt; values related to the current block&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Local variables
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;They are those that occur during execution. In the EVM it is the part corresponding to volatile memory&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  State variables
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;They are variables that are stored in the ROM portion of the EVM. It's persistent memory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwkqtw35gi4jqmotypsaj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwkqtw35gi4jqmotypsaj.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  DATA TYPES
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Integers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;uint&lt;/code&gt; nonnegative (8 - 256 bits)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;int&lt;/code&gt;  8 - (256 bits)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Boolean
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;true&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Address
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;address&lt;/code&gt; This type of data represents addresses of ETH (20 bytes)&lt;/li&gt;
&lt;li&gt;contains methods like &lt;code&gt;.transfer&lt;/code&gt; or &lt;code&gt;.balance&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  String
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;string&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bytes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bytes&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>smart</category>
      <category>web3</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Drag and Drop in React</title>
      <dc:creator>kevin david cuadros</dc:creator>
      <pubDate>Tue, 05 Apr 2022 19:30:54 +0000</pubDate>
      <link>https://dev.to/cuadroscode/drag-and-drop-bj1</link>
      <guid>https://dev.to/cuadroscode/drag-and-drop-bj1</guid>
      <description>&lt;p&gt;In this example it was created whit &lt;strong&gt;React&lt;/strong&gt; and &lt;strong&gt;typescript&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drag and drop area
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div
  onDrop={handleDrop}
  onDragOver={handleDragOver}
  onDragEnter={handleDragEnter}
  onDragLeave={handleDragLeave}
&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Actions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const handleDragOver = ( e: DragEvent&amp;lt;HTMLDivElement&amp;gt;) =&amp;gt; {
    e.preventDefault();
    e.stopPropagation();
  };

  const handleDragEnter = ( e: DragEvent&amp;lt;HTMLDivElement&amp;gt;) =&amp;gt; {
    e.preventDefault();
    e.stopPropagation();
  };

  const handleDragLeave = ( e: DragEvent&amp;lt;HTMLDivElement&amp;gt;) =&amp;gt; {
    e.preventDefault();
    e.stopPropagation();
 };

 const handleDrop = ( e: DragEvent&amp;lt;any&amp;gt;) =&amp;gt; {
    e.preventDefault();
    e.stopPropagation();
    // the 'files' constant contains the documents
    const files = e.dataTransfer.files;
 };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Smart contracts for ALL #1</title>
      <dc:creator>kevin david cuadros</dc:creator>
      <pubDate>Tue, 05 Apr 2022 19:01:39 +0000</pubDate>
      <link>https://dev.to/cuadroscode/smart-contracts-for-all-9cm</link>
      <guid>https://dev.to/cuadroscode/smart-contracts-for-all-9cm</guid>
      <description>&lt;h1&gt;
  
  
  Getting Started Guide
&lt;/h1&gt;

&lt;p&gt;A smart contract is a piece of code running in a blockchain in this case we use &lt;a href="https://soliditylang.org/" rel="noopener noreferrer"&gt;Solidity&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1 Where to use solidity ?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;the easy way is use &lt;a href="https://remix-project.org/" rel="noopener noreferrer"&gt;Remix&lt;/a&gt; (Remix is a code editor online)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2 How defined a smart contract ?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;2.1 as a comment we write the license
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;// SPDX-License-Identifier: GPL-3.0&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2.2 versions available for run the contract
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;pragma solidity &amp;gt;=0.7.0 &amp;lt;0.9.0;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  3 My first contract
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;3.1 just as we define a class in other languages in solidity we write the word 'contract'
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract Asset { } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4 Types in solidity
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Booleans
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bool
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Integers
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int / uint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Address
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;address
address payable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  sorry for the grammar I'm not very good at english
&lt;/h4&gt;

</description>
      <category>blockchain</category>
      <category>solidity</category>
      <category>programming</category>
      <category>web3</category>
    </item>
    <item>
      <title>Cambiar la forma de importar un archivo en React</title>
      <dc:creator>kevin david cuadros</dc:creator>
      <pubDate>Mon, 16 Aug 2021 16:40:56 +0000</pubDate>
      <link>https://dev.to/cuadroscode/cambiar-la-forma-de-importar-un-archivo-en-react-1d3i</link>
      <guid>https://dev.to/cuadroscode/cambiar-la-forma-de-importar-un-archivo-en-react-1d3i</guid>
      <description>&lt;p&gt;Por lo regular cuando queremos importar un archivo dentro de nuestro componente hacemos esto &lt;code&gt;import context from '../../context/ProjectContext'&lt;/code&gt; pero este tipo de importación puede llegar a generar confusión. Para solucionar esto debemos crear en la raiz de nuestro proyecto el archivo &lt;code&gt;jsconfig.json&lt;/code&gt; y dentro de este archivo escribir el siguiente codigo&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"]
}

A partir de esto ya podras hacer la importación de esta forma `import context from 'context/ProjectContext'`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>spanish</category>
    </item>
  </channel>
</rss>
