<?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: sharath Kumar</title>
    <description>The latest articles on DEV Community by sharath Kumar (@sharu725).</description>
    <link>https://dev.to/sharu725</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%2F204840%2F96e2f138-756e-4351-b9c5-9ccfc6d41ff2.jpeg</url>
      <title>DEV Community: sharath Kumar</title>
      <link>https://dev.to/sharu725</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sharu725"/>
    <language>en</language>
    <item>
      <title>Svelte Todo CRUD App </title>
      <dc:creator>sharath Kumar</dc:creator>
      <pubDate>Thu, 05 Aug 2021 14:00:23 +0000</pubDate>
      <link>https://dev.to/sharu725/svelte-todo-crud-app-545e</link>
      <guid>https://dev.to/sharu725/svelte-todo-crud-app-545e</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3hOM1p7T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eznu2kjcvswdgb57zysw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3hOM1p7T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eznu2kjcvswdgb57zysw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://youtu.be/yLwwJtCFDNo"&gt;Introduction&lt;/a&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://youtu.be/AV04qN6frmE"&gt;Create Simple Todo App using Svelte&lt;/a&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://youtu.be/50s6IKO8028"&gt;Deleting Todos&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;There will be more videos coming. Subscribe to get udpates.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SvelteKit Tutorial</title>
      <dc:creator>sharath Kumar</dc:creator>
      <pubDate>Wed, 16 Jun 2021 09:02:10 +0000</pubDate>
      <link>https://dev.to/sharu725/sveltekit-tutorial-2e5d</link>
      <guid>https://dev.to/sharu725/sveltekit-tutorial-2e5d</guid>
      <description>&lt;p&gt;I have a series of SvelteKit tutorial videos. I have discussed the basic used cases using which you can build things that you desire. &lt;/p&gt;

&lt;p&gt;I guess if I give you bricks, you can build walls, bridges or a mansion. That's what I tried here. Check it out.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=Gtg4yG8Bhcs"&gt;Intro, Pages &amp;amp; Layouts - Sveltekit Tutorial 1&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I will be talking about Sveltekit. What is Sveltekit? How to create pages in sveltekit? How to create layouts in Sveltekit? How to create components in Sveltekit?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=rW3-mR6Odvk"&gt;Layout Reset - Sveltekit Tutorial 2&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I have explained how to create an entirely different layout for a &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=cqdEHFPSZwg"&gt;Dynamic Routes - Sveltekit Tutorial 3&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I'm talking about how to use sveltekit dynamic routes and how to get the page parameters in out routes. This is a stepping stone to build blogs using sveltekit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=_f4elR-cIpc"&gt;Layouts for pages - Sveltekit Tutorial 4&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I'll be showing you how you can have a different layout for a page even if it is in the same level as other pages.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=amuuoNIJJvA"&gt;Multiple Layouts - Sveltekit Tutorial 5&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I will be showing how to use multiple layouts for a page in Sveltekit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://youtu.be/OdQruaoDVj0"&gt;Sveltekit Error Pages - Sveltekit Tutorial 6&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I will be showing how to use create error pages in Sveltekit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://youtu.be/NHWCtmmDIjo"&gt;Sveltekit Endpoints - Sveltekit Tutorial 7&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I will be showing how to create backend endpoints in Sveltekit. I will be showing only the GET request in this one.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://youtu.be/jpKbyiQsj3k"&gt;Sveltekit Post Request - Sveltekit Tutorial 8&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video, I will be talking about Sveltekit POST reqests. How we can send data from our components to the backend and how we can handle the request.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://youtu.be/ekIPuJjbXm0"&gt;SvelteKit Post Endpoint Part 2 - Sveltekit Tutorial 9&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video, I will be talking about Sveltekit HTTP requests which can be used in the same endpoint.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=6lNrvFSRmwY"&gt;A Simple Blog - Sveltekit Tutorial 10&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video, I will show you how to build a simple Sveltekit blog using an API.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://www.youtube.com/watch?v=dLLmppgxM5E"&gt;A Simple Blog Part 2 - Sveltekit Tutorial 11&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In this video I will be creating a route to show the blog author. This is a small incremental addition to what we did in the first part where we created a simple SvelteKit Blog.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://www.youtube.com/playlist?list=PLm_Qt4aKpfKgonq1zwaCS6kOD-nbOKx7V"&gt;How to create a markdown blog in Svelte&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This video helps you create your own markdown blog with amazing features like component import into markdown or creating a component inside a markdown post.&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>sveltekit</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>That was easy! - Svelte Shopping Cart</title>
      <dc:creator>sharath Kumar</dc:creator>
      <pubDate>Sun, 14 Feb 2021 12:22:55 +0000</pubDate>
      <link>https://dev.to/sharu725/that-was-easy-svelte-shopping-cart-p64</link>
      <guid>https://dev.to/sharu725/that-was-easy-svelte-shopping-cart-p64</guid>
      <description>&lt;p&gt;While learning JavaScript, I started building this simple e-commerce shopping cart which had some basic functionalities,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add products.&lt;/li&gt;
&lt;li&gt;Show products in the cart.&lt;/li&gt;
&lt;li&gt;Update product quantity in the cart.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It seems really simple but I had a hard time doing it. But when I tried the same in Svelte, it felt like a breeze.&lt;/p&gt;

&lt;p&gt;Check out this REPL: &lt;a href="https://svelte.dev/repl/f894a09732d74059b4820324dae003c1?version=3.32.3" rel="noopener noreferrer"&gt;Svelte shopping cart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will show you - with snippets - how I did it.&lt;/p&gt;

&lt;p&gt;Create an array of products. Each products usually will have details like id, name, image, price etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/path/to/apple.png&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Orange&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/path/to/apple.png&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Grapes&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/path/to/apple.png&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an empty array called cart. The idea is to add items from products to the cart whenever &lt;strong&gt;Add to cart&lt;/strong&gt; is clicked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's show these prodcuts along with a button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"product-list"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 {#each products as product}
   &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"background-image: url({product.image})"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h4&amp;gt;&lt;/span&gt;{product.name}&lt;span class="nt"&gt;&amp;lt;/h4&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;₹{product.price}&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&amp;gt;&lt;/span&gt;Add to cart&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 {/each}
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
 &lt;span class="nc"&gt;.product-list&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="py"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should display it in a grid with add a non-functional button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9y10ercbwii8uij5w944.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9y10ercbwii8uij5w944.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's add a function &lt;code&gt;addToCart()&lt;/code&gt; to buttons. We will have to send the prodcut along with this function as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;on:click=&lt;/span&gt;&lt;span class="s"&gt;{()&lt;/span&gt; &lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; addToCart(product)}&amp;gt;Add to cart&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can create this function to receive the sent product and push it to the cart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;addToCart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, in Svelte this will not be reactive because there is not assignment used. We can rewite this usig spread operator as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;addToCart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The problem with this is that when you add the same item multiple times, it keeps on adding to the cart array. We don't want that. We would like only the quantity of the cart item to increase if it is already present.&lt;/p&gt;

&lt;p&gt;When &lt;strong&gt;Add to cart&lt;/strong&gt; is clicked, we can go through all the cart items to see whether the item just added is already in the cart, if so then we increment the quantity as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;addToCart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quantity&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can display the cart a better way as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"cart-list"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 {#each cart as item }
   &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"cart-item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"50"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;{item.image}&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;{item.name}/&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;{item.quantity}&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;₹{item.price * item.quantity}&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 {/each}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbrx0s00mo1w72teql6i2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbrx0s00mo1w72teql6i2.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also add buttons besides quantity to add or remove the items added to the cart. This function is pretty much same as the &lt;code&gt;addToCart()&lt;/code&gt; function that we already discussed.&lt;/p&gt;

&lt;p&gt;Let's add those buttons with functions sending product as parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;{#each cart as item }
 &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"cart-item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"50"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;{item.image}&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;{item.name}/&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;{item.quantity}

     &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;on:click=&lt;/span&gt;&lt;span class="s"&gt;{()&lt;/span&gt; &lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; minusItem(item)}&amp;gt;-&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;on:click=&lt;/span&gt;&lt;span class="s"&gt;{()&lt;/span&gt; &lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; plusItem(item)}&amp;gt;+&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;₹{item.price * item.quantity}&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
{/each}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can define those functions to add or remove items from the cart array as shown here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;minusItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quantity&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
     &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;plusItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quantity&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
     &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should take care of the button functions in the cart.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0tp9yg7yy68apciyy0ij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0tp9yg7yy68apciyy0ij.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now this is almost complete. But I have used a single component. In the next article I will be doing the following,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use components to simplify the app.&lt;/li&gt;
&lt;li&gt;Use writable store to maintain state across the app.&lt;/li&gt;
&lt;li&gt;Use session store to persist the cart even on browser refresh.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch the vide here:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Jh_12JeLtMo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Why I like Svelte</title>
      <dc:creator>sharath Kumar</dc:creator>
      <pubDate>Fri, 29 Jan 2021 14:23:04 +0000</pubDate>
      <link>https://dev.to/sharu725/why-i-like-svelte-12ea</link>
      <guid>https://dev.to/sharu725/why-i-like-svelte-12ea</guid>
      <description>&lt;p&gt;I have many reasons to like Svelte. I have tried to mention most of them in this article. I hope - at the end of it - you also will appreciate Svelte.&lt;/p&gt;

&lt;p&gt;Svelte is a disappearing JavaScript framework. Initially, it was promoted that way. Because, once you build an app with Svelte, there usually is no way of telling that it is using Svelte.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Web developer-friendly
&lt;/h2&gt;

&lt;p&gt;I'm a web developer and I like HTML, CSS, and JavaScript. To be honest, I never really liked any JS framework before because they asked me to learn something new. Sometimes new syntax, sometimes new ways to use the markup so on and so forth.&lt;/p&gt;

&lt;p&gt;I'm ok to learn new things but I did not dig deep into any of them because they felt like a deviation from the regular HTML, CSS, and JavaScript that I used every day.&lt;/p&gt;

&lt;p&gt;Eventually, I had to take up React for a project of which I was been apart for a long time. It was kind of forced on to me but I started liking it. I understood the true productivity and simplicity that can be obtained from a JavaScript framework.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;But, I did not like how React uses JSX or HTML inside JavaScript. That always felt wrong.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Along with all these, I was also trying to learn Vuejs which seemed more like HTML and less like JSX.&lt;/p&gt;

&lt;p&gt;I still love Vue for the fact that you can just put a script tag in any HTML app and you can start using Vue. Which is fantastic. This is exactly how we add a Javascript plugin to HTML. Let's say you are designing a homepage and you want a carousel or slider, you just go to the slick carousel page, get the script tag, and use it on your website with some initializations. That's it. You can start using it. In that way Vue was revolutionary. For me at least.&lt;/p&gt;

&lt;p&gt;I was still into Vue until I watched the &lt;a href="https://www.youtube.com/watch?v=AdNJ3fydeao"&gt;"Rethinking Reactivity"&lt;/a&gt; video on youtube. I'm not sure how I ended up watching that video but I'm glad I watched it.&lt;/p&gt;

&lt;p&gt;I still watch it from time to time to understand the Genius of Rich Harris. How he looked at these JS frameworks from a different angle and utilized the compiler instead of the browser to handle all the logic. And also, How he found a way to truly reactify elements without DOM diffing where you change something in Virtual DOM and compare it with the actual DOM. And then update the difference to the actual DOM.&lt;/p&gt;

&lt;p&gt;And in that way - since svelte is truly reactive - he got rid of Virtual DOM completely which is radically different from other frameworks. Because the other frameworks still use Virtual DOM which is an overhead.&lt;/p&gt;

&lt;p&gt;So Svelte was mind-blowing for me because finally, I found this JavaScript framework that isn't difficult to learn, uses less code to achieve the same thing, and the most important of all it spits out a tiny JS file that doesn't need any Runtime environment to run.&lt;/p&gt;

&lt;p&gt;That should be enough to be excited about svelte but there are other things I like about Svelte.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. You can just write HTML
&lt;/h2&gt;

&lt;p&gt;Svelte is a superset of HTML. I feel like it is HTML but with a lot of enhancements.&lt;/p&gt;

&lt;p&gt;You can write HTML components without any JavaScript(you may need a line or two to import them).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Svelte is HTML with super-powers!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Even a simple paragraph tag works, just like any HTML file.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Scoped style
&lt;/h2&gt;

&lt;p&gt;In Sveltejs, every component is encapsulated. The CSS is localized to a component, doesn't affect other components.&lt;/p&gt;

&lt;p&gt;It solves a huge problem of cascading. I have had problems with CSS being all over the place. You change it somewhere for one element and it affects some other element.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You'll like using the plain old CSS in Svelte.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can also have a global style that applies to all elements of the same tag or class which is nice if you want to apply styles across all Svelte components.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. True Web Components
&lt;/h2&gt;

&lt;p&gt;In a way, I feel Svelte components are complete. It has HTML, CSS, and JS in a single file. For example, take this small component,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;world&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello {name}!&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;bind:value=&lt;/span&gt;&lt;span class="s"&gt;"{name}"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;royalblue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just these lines create a two-way data binding component.&lt;/p&gt;

&lt;p&gt;REPL: &lt;a href="https://svelte.dev/repl/3077fcb3c0be4433a89521b4382b0d07?version=3"&gt;Two-Way Data Binding&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can do this in React also, but you'll get tired. The code will not be readable. Even now I'm not very sure how to work with styles in React. Currently - at work - we use the Tailwind CSS framework. So it isn't a big problem but if I have to write plain old CSS then it becomes tricky.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kent Beck&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;The above quote from Kent Beck's quote says a lot about how bad some JS frameworks are today.&lt;/p&gt;

&lt;p&gt;At my work, I have to explain to my co-workers what is happening in a React component. Just by going through the code, they will not know what the hell is happening. Svelte kinda solves this problem.&lt;/p&gt;

&lt;p&gt;The example you see at the top is easily readable and comprehensive. I do not think I have to explain what is happening there.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Easy to learn for JS beginners
&lt;/h2&gt;

&lt;p&gt;The learning curve is almost nil. If you know a little bit of JS then you can start using Svelte.&lt;/p&gt;

&lt;p&gt;There aren't many syntaxes to learn compared to other JavaScript frameworks like React, Vue.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;JS can be hard but doesn't feel that way in Svelte.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are some directives that we use in Svelte that you may have to learn but they seem natural.&lt;/p&gt;

&lt;p&gt;Refer: &lt;a href="https://svelte.dev/docs#bind_element"&gt;Svelte Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Write Less
&lt;/h2&gt;

&lt;p&gt;In svelte, the number of lines you write is less when compared to other top JS frameworks.&lt;/p&gt;

&lt;p&gt;Let's say you want to bind an input to a variable and show it - as shown in the above example - it takes way less code in Svelte. I have had a hard time doing this in React.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Less code = less erros &amp;amp; bugs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Debugging feels way better in Svelte than other Frameworks.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Amazing performance
&lt;/h2&gt;

&lt;p&gt;Svelte performs astonishingly well compared to apps developed with other frameworks. I have developed a decent e-commerce site that uses Svelte and Tailwind and the performance is amazing.&lt;/p&gt;

&lt;p&gt;I had so much fun developing it. Previously, it was built using jQuery and the performance was fairly good. But it was still loading the entire jQuery script which is huge. After converting it to Svelte, the bundle size is really small. Not to mention that I do not add more scripts to get animations which I used to do before. Svelte does it for me.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Try Svelte for an exhilarating developer experience&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So I think I have mentioned everything that made me choose Svelte. Let me know in the comments if you like Svelte, or why do you like Svelte, or what made you like svelte.&lt;/p&gt;

&lt;p&gt;Watch the video here &lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/wY6unLTuMsU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
