<?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: OooopsItsMe</title>
    <description>The latest articles on DEV Community by OooopsItsMe (@oooopsitsme).</description>
    <link>https://dev.to/oooopsitsme</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%2F1242586%2F0af4d14e-13dd-4fa9-86cd-942768822d99.png</url>
      <title>DEV Community: OooopsItsMe</title>
      <link>https://dev.to/oooopsitsme</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oooopsitsme"/>
    <language>en</language>
    <item>
      <title>Why You Should Use `lodash-es` in Your TypeScript Projects</title>
      <dc:creator>OooopsItsMe</dc:creator>
      <pubDate>Fri, 23 Aug 2024 09:18:22 +0000</pubDate>
      <link>https://dev.to/oooopsitsme/why-you-should-use-lodash-es-in-your-typescript-projects-153n</link>
      <guid>https://dev.to/oooopsitsme/why-you-should-use-lodash-es-in-your-typescript-projects-153n</guid>
      <description>&lt;p&gt;When you're working with TypeScript, you want your code to be efficient, clean, and maintainable. That’s where &lt;code&gt;lodash-es&lt;/code&gt; comes in. If you're familiar with Lodash, you already know its power. But did you know &lt;code&gt;lodash-es&lt;/code&gt; is even better for modern TypeScript projects? Let’s explore why!&lt;/p&gt;

&lt;h2&gt;
  
  
  What is &lt;code&gt;lodash-es&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;lodash-es&lt;/code&gt; is the ECMAScript module (ESM) version of Lodash. It's designed to be tree-shakeable, meaning you only include the parts of the library you actually use in your bundle. This is a huge win for keeping your final JavaScript file size smaller and faster.&lt;/p&gt;

&lt;p&gt;Why did the developer go broke? Because they used &lt;code&gt;lodash&lt;/code&gt;… but forgot to tree-shake! 💸&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using &lt;code&gt;lodash-es&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Tree-Shaking&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;One of the biggest advantages of &lt;code&gt;lodash-es&lt;/code&gt; is its support for tree-shaking. Tree-shaking is a process that removes unused code from your final bundle, which helps to reduce the size of the JavaScript files your users download. With traditional Lodash, importing a single method could unintentionally import the entire library. But with &lt;code&gt;lodash-es&lt;/code&gt;, thanks to ESM, your bundler can easily eliminate unused code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example with lodash-es&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;debounce&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lodash-es&lt;/span&gt;&lt;span class="dl"&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;saveInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;debounce&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Saving data...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, only the &lt;code&gt;debounce&lt;/code&gt; method will be included in your final bundle, not the entire Lodash library.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;TypeScript Support&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Lodash has excellent TypeScript support, with types available out of the box. This makes working with &lt;code&gt;lodash-es&lt;/code&gt; a breeze when using TypeScript. It provides type definitions that help catch errors early in the development process, and provides better autocompletion and documentation directly in your editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;find&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lodash-es&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;[]&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="s1"&gt;Alice&lt;/span&gt;&lt;span class="dl"&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;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="s1"&gt;Bob&lt;/span&gt;&lt;span class="dl"&gt;'&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;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Alice&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type safety ensures that you’re passing the correct arguments and getting the expected return types, reducing the chance of runtime errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Modularity and Performance&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Using &lt;code&gt;lodash-es&lt;/code&gt; helps you write modular code. By importing only the functions you need, your codebase stays more organized and easier to manage. This approach also boosts your application's performance by keeping the bundle size smaller, which directly impacts load times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Switching to &lt;code&gt;lodash-es&lt;/code&gt; in your TypeScript projects offers several benefits, from reduced bundle sizes through tree-shaking to better TypeScript support. It's a no-brainer if you're aiming for a modern, efficient, and maintainable codebase. So next time you reach for Lodash, give &lt;code&gt;lodash-es&lt;/code&gt; a try and enjoy a cleaner, leaner project!&lt;/p&gt;

&lt;p&gt;For further reading on &lt;code&gt;lodash-es&lt;/code&gt;, you can visit the &lt;a href="https://www.npmjs.com/package/lodash-es" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>First post: Vue learning plan</title>
      <dc:creator>OooopsItsMe</dc:creator>
      <pubDate>Thu, 07 Mar 2024 13:19:30 +0000</pubDate>
      <link>https://dev.to/oooopsitsme/first-post-vue-learning-plan-43k4</link>
      <guid>https://dev.to/oooopsitsme/first-post-vue-learning-plan-43k4</guid>
      <description>&lt;p&gt;Vue as most of us know, has gone through a lot of changes mainly introduced through the composition API, in this article, I started a guide to help new Vue lovers or those trying to move from other frameworks to VueJs. I will make more articles to cover more related concepts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/template-syntax.html" rel="noopener noreferrer"&gt;Template syntax&lt;/a&gt;:&lt;/strong&gt; Basically here you will learn about the

&lt;code&gt;&amp;lt;template&amp;gt; &amp;lt;template/&amp;gt;&lt;/code&gt;

part found in any in any &lt;strong&gt;SFC&lt;/strong&gt; (Single File Component)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/reactivity-fundamentals.html" rel="noopener noreferrer"&gt;Reactivity&lt;/a&gt;&lt;/strong&gt; : Here you will learn about how you interact with data (creation, accessibility,...). also you will learn about

&lt;code&gt;ref()&lt;/code&gt;

and

&lt;code&gt;reactive()&lt;/code&gt;

which will help you deal with that, you will learn the difference between both of them and you'll get to decide when to use each one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The reason why &lt;code&gt;ref&lt;/code&gt; is used for single values, while &lt;code&gt;reactive&lt;/code&gt; is used for objects or nested data structures, lies in the way Vue 3's reactivity system works under the hood.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;ref&lt;/code&gt; for single values&lt;/strong&gt;:&lt;br&gt;
The &lt;code&gt;ref&lt;/code&gt; function is designed to handle the reactivity of single, primitive values like strings, numbers, and booleans. These values are known as "plain old data" or "immutable data" because they cannot be modified directly; instead, they need to be reassigned to a new value.&lt;/p&gt;

&lt;p&gt;When you create a reactive reference using &lt;code&gt;ref(value)&lt;/code&gt;, Vue internally wraps the value in an object and creates a getter and setter for the &lt;code&gt;.value&lt;/code&gt; property. This allows Vue to track changes to the value and trigger updates whenever the &lt;code&gt;.value&lt;/code&gt; property is reassigned.&lt;/p&gt;

&lt;p&gt;Here's a simplified example of how &lt;code&gt;ref&lt;/code&gt; works internally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function ref(value) {
  const wrapper = {
    value,
    get value() {
      // Track dependency
      return value
    },
    set value(newValue) {
      // Trigger updates
      value = newValue
    }
  }
  return wrapper
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using &lt;code&gt;.value&lt;/code&gt; to access and update the value, Vue can properly track dependencies and trigger updates when necessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;reactive&lt;/code&gt; for objects and nested data structures&lt;/strong&gt;:&lt;br&gt;
On the other hand, the &lt;code&gt;reactive&lt;/code&gt; function is designed to handle the reactivity of objects and nested data structures, such as arrays, objects, and more complex data types. These data structures are known as "mutable data" because their properties or elements can be directly modified.&lt;/p&gt;

&lt;p&gt;When you create a reactive object using &lt;code&gt;reactive(obj)&lt;/code&gt;, Vue internally "proxies" the object, which means it creates a special proxy object that wraps the original object. This proxy object intercepts property access and mutations on the original object, allowing Vue to track dependencies and trigger updates accordingly.&lt;/p&gt;

&lt;p&gt;Here's a simplified example of how &lt;code&gt;reactive&lt;/code&gt; works internally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function reactive(obj) {
  const proxy = new Proxy(obj, {
    get(target, key) {
      // Track dependency
      return target[key]
    },
    set(target, key, value) {
      // Trigger updates
      target[key] = value
      return true
    }
  })
  return proxy
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using the proxy object, Vue can intercept property access and mutations, track dependencies, and trigger updates when necessary.&lt;/p&gt;

&lt;p&gt;The reason &lt;code&gt;reactive&lt;/code&gt; is preferred for objects and nested data structures is that it provides a more efficient and straightforward way to handle reactivity for these complex data types. With &lt;code&gt;ref&lt;/code&gt;, you would need to create multiple reactive references for each property or element, which can become cumbersome and less efficient for larger data structures.&lt;/p&gt;

&lt;p&gt;Additionally, using &lt;code&gt;reactive&lt;/code&gt; for objects and nested data structures better aligns with the way developers typically work with these data types in JavaScript, making the code more intuitive and easier to reason about.&lt;/p&gt;

&lt;p&gt;In summary, &lt;code&gt;ref&lt;/code&gt; is used for single, primitive values because it provides a simple way to create reactive references and track changes to these immutable data types. &lt;code&gt;reactive&lt;/code&gt;, on the other hand, is used for objects and nested data structures because it leverages the power of proxies to efficiently handle reactivity for mutable data types, while preserving the natural way of working with objects and arrays in JavaScript.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/computed.html" rel="noopener noreferrer"&gt;Computed properties&lt;/a&gt;&lt;/strong&gt; : They are basically 'automatically calculated variables', they can be used in both template and script parts in vue components. Generally we use them to get a value or an object that changes based other value(s). ex:
&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;script setup&amp;gt;
import { reactive, computed } from 'vue'

const input = ref({
    weight: 82,
    height: 1,70
})

// a computed ref
const bmi = computed(() =&amp;gt; { return input.weight/(Math.sqrt(input.height)) })
&amp;lt;/script&amp;gt;

&amp;lt;template&amp;gt;
  &amp;lt;span&amp;gt;Your BMI is: {{ bmi }}&amp;lt;/span&amp;gt;
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/class-and-style.html" rel="noopener noreferrer"&gt;Class/Style binding&lt;/a&gt;&lt;/strong&gt; : Here you will mainly learn about how you can interact with your css using data binding to make it adapt to any situation you come across. Ex: conditionally apply a dark mode styling depending on the value returned from a dark mode toggle&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/api/built-in-directives.html#built-in-directives" rel="noopener noreferrer"&gt;Directives&lt;/a&gt;&lt;/strong&gt; Also knows as life saviors hhhhh, they are special HTML attributes with the prefix &lt;strong&gt;v-&lt;/strong&gt; that give the HTML tag extra functionality. Better check &lt;a href="https://vuejs.org/guide/essentials/conditional.html" rel="noopener noreferrer"&gt;the difference between &lt;strong&gt;v-if&lt;/strong&gt; and &lt;strong&gt;v-show&lt;/strong&gt;&lt;/a&gt; to learn more about conditional rendering. also check &lt;a href="https://vuejs.org/guide/essentials/list.html" rel="noopener noreferrer"&gt;List rendering using &lt;strong&gt;v-for&lt;/strong&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/event-handling.html" rel="noopener noreferrer"&gt;Event Handling&lt;/a&gt;&lt;/strong&gt; : In Vue.js, event handling allows you to respond to user interactions, such as clicks, input changes, and other DOM events. Here's a summary of event handling in Vue.js:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. &lt;strong&gt;Handling DOM Events:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;v-on Directive:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;v-on&lt;/code&gt; directive is used to attach event listeners to DOM elements.&lt;/li&gt;
&lt;li&gt;It can be used in various ways, such as &lt;code&gt;v-on:click&lt;/code&gt;, &lt;code&gt;v-on:input&lt;/code&gt;, etc.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Shorthand for v-on:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Vue provides a shorthand for &lt;code&gt;v-on&lt;/code&gt; using the &lt;code&gt;@&lt;/code&gt; symbol. For example, &lt;code&gt;@click&lt;/code&gt; is equivalent to &lt;code&gt;v-on:click&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Methods for Event Handling:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Event Handling Methods:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can define methods in your Vue instance or component and call them when an event occurs.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button v-on:click="handleClick"&amp;gt;Click me&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

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


&lt;/li&gt;

&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```
    new Vue({
      methods: {
        handleClick() {
          console.log('Button clicked!');
        }
      }
    });
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Passing Parameters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can pass additional parameters to your methods using the &lt;code&gt;v-on&lt;/code&gt; directive.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button v-on:click="handleClick('Hello')"&amp;gt;Click me&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

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


&lt;/li&gt;

&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```
    new Vue({
      methods: {
        handleClick(message) {
          console.log('Button clicked with message:', message);
        }
      }
    });
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;strong&gt;Event Modifiers:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Preventing Default:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;.prevent&lt;/code&gt; modifier to prevent the default behavior of an event.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form v-on:submit.prevent="handleSubmit"&amp;gt;Submit&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

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


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Stop Propagation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;.stop&lt;/code&gt; modifier to stop the event propagation.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div v-on:click.stop="handleClick"&amp;gt;Click me&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

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


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Key Modifiers:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can use key modifiers to respond to specific keys. For example, &lt;code&gt;@keydown.enter&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Inline Statements:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inline Event Handling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can also handle events directly in the template using inline statements.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button @click="() =&amp;gt; { console.log('Button clicked!'); }"&amp;gt;Click me&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

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


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Custom Events:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Custom Event Handling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Components can emit custom events to communicate with their parent components.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Child Component --&amp;gt;
&amp;lt;button @click="notifyParent"&amp;gt;Click me&amp;lt;/button&amp;gt;

&amp;lt;script&amp;gt;
  methods: {
    notifyParent() {
      this.$emit('custom-event', 'Hello from child!');
    }
  }
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

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


&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;!-- Parent Component --&amp;gt;
    &amp;lt;child-component @custom-event="handleCustomEvent"&amp;gt;&amp;lt;/child-component&amp;gt;

    &amp;lt;script&amp;gt;
      methods: {
        handleCustomEvent(message) {
          console.log('Received custom event:', message);
        }
      }
    &amp;lt;/script&amp;gt;
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are the fundamental concepts of event handling in Vue.js. Understanding these concepts will help you create interactive and responsive Vue.js applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/forms.html" rel="noopener noreferrer"&gt;Form Binding&lt;/a&gt;&lt;/strong&gt; : Here you will learn about how to your template will interact with your data, whether how your is fed to a form or how you go from data in your

&lt;code&gt;&amp;lt;textarea/&amp;gt;&lt;/code&gt;

input to a property in an object 
- &lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/lifecycle.html" rel="noopener noreferrer"&gt;Component lifecycle&lt;/a&gt;&lt;/strong&gt; : This is where you will learn about the different series of initialization steps a component goes through when it's created and how you can use them for your advantage, Ex: thanks to &lt;strong&gt;onMounted()&lt;/strong&gt; hook, you can load your table data right when the component is mounted.
- &lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/watchers.html" rel="noopener noreferrer"&gt;Watchers&lt;/a&gt;&lt;/strong&gt;  : You can consider them as literal data surveillance dogs. you can program them to make any callback. right after the value of a property changes and they can be configured too.
In Vue 3's Composition API, both &lt;code&gt;watch&lt;/code&gt; and &lt;code&gt;watchEffect&lt;/code&gt; are functions used for reactively watching data sources, but they differ in their behavior and use cases. Here's an explanation of the differences between them:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;watch&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
The &lt;code&gt;watch&lt;/code&gt; function is used to watch one or more reactive data sources and perform side effects or update other reactive data based on the changes. It takes two arguments: a source (reactive data source or getter function) and a callback function.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { ref, watch } from 'vue'

const count = ref(0)
const doubled = ref(0)

watch(count, (newCount, oldCount) =&amp;gt; {
  doubled.value = newCount * 2
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;watch&lt;/code&gt; observes changes to the &lt;code&gt;count&lt;/code&gt; reactive reference and updates the &lt;code&gt;doubled&lt;/code&gt; reactive reference with the new doubled value whenever &lt;code&gt;count&lt;/code&gt; changes.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;watch&lt;/code&gt; function is useful when you need to perform side effects or update other reactive data based on changes to specific data sources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;watchEffect&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
The &lt;code&gt;watchEffect&lt;/code&gt; function is a more low-level and powerful way to reactively watch data sources. It takes a single function as an argument, and this function is automatically re-executed whenever any of its reactive dependencies (data sources it accesses) change.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { ref, watchEffect } from 'vue'

const count = ref(0)
const doubled = ref(0)

watchEffect(() =&amp;gt; {
  doubled.value = count.value * 2
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;watchEffect&lt;/code&gt; automatically tracks the reactive dependencies (in this case, &lt;code&gt;count&lt;/code&gt;) inside its callback function. Whenever &lt;code&gt;count&lt;/code&gt; changes, the callback function is re-executed, and &lt;code&gt;doubled&lt;/code&gt; is updated with the new doubled value.&lt;/p&gt;

&lt;p&gt;The key difference between &lt;code&gt;watchEffect&lt;/code&gt; and &lt;code&gt;watch&lt;/code&gt; is that &lt;code&gt;watchEffect&lt;/code&gt; automatically tracks dependencies, while &lt;code&gt;watch&lt;/code&gt; requires you to explicitly specify the data sources to watch.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;watchEffect&lt;/code&gt; is useful when you have a complex computation or side effect that depends on multiple reactive data sources, and you don't want to explicitly list all of them in a &lt;code&gt;watch&lt;/code&gt; call.&lt;/p&gt;

&lt;p&gt;Here are some additional differences between &lt;code&gt;watch&lt;/code&gt; and &lt;code&gt;watchEffect&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;-- &lt;strong&gt;Cleanup&lt;/strong&gt;: The callback function passed to &lt;code&gt;watchEffect&lt;/code&gt; can optionally return a cleanup function, which will be called before the effect is re-executed or the component is unmounted. This is useful for cleaning up side effects like timers or event listeners. In contrast, &lt;code&gt;watch&lt;/code&gt; does not provide a built-in mechanism for cleanup.&lt;/p&gt;

&lt;p&gt;-- &lt;strong&gt;Lazy Initialization&lt;/strong&gt;: &lt;code&gt;watchEffect&lt;/code&gt; is lazy, meaning it will not execute its callback function until its reactive dependencies are accessed for the first time. This can be useful for performance optimization. &lt;code&gt;watch&lt;/code&gt;, on the other hand, will execute its callback immediately after the component is mounted.&lt;/p&gt;

&lt;p&gt;-- &lt;strong&gt;Manual Invalidation&lt;/strong&gt;: &lt;code&gt;watchEffect&lt;/code&gt; provides a way to manually invalidate and re-execute the effect using the &lt;code&gt;watchEffect&lt;/code&gt; function's return value (an &lt;code&gt;invalidate&lt;/code&gt; function). This can be useful for handling external data sources or manually triggering updates. &lt;code&gt;watch&lt;/code&gt; does not provide a similar mechanism.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/template-refs.html" rel="noopener noreferrer"&gt;Template Refs&lt;/a&gt;&lt;/strong&gt; : While Vue's declarative rendering model abstracts away most of the direct DOM operations for you, there may still be cases where we need direct access to the underlying DOM elements. To achieve this, we can use the special &lt;code&gt;ref&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://vuejs.org/guide/essentials/component-basics.html" rel="noopener noreferrer"&gt;Component Basics&lt;/a&gt;&lt;/strong&gt; here you will learn about:

&lt;ul&gt;
&lt;li&gt; Defining a Component&lt;/li&gt;
&lt;li&gt; Using a Component&lt;/li&gt;
&lt;li&gt; Passing Props&lt;/li&gt;
&lt;li&gt; Listening to Events&lt;/li&gt;
&lt;li&gt; Content Distribution with Slots&lt;/li&gt;
&lt;li&gt; Dynamic Components&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>vue</category>
      <category>vue3</category>
    </item>
  </channel>
</rss>
