<?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>Forem: Raj</title>
    <description>The latest articles on Forem by Raj (@raj_vue).</description>
    <link>https://forem.com/raj_vue</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%2F978823%2F599a3155-5e30-4966-8535-fa49cd168ab6.jpeg</url>
      <title>Forem: Raj</title>
      <link>https://forem.com/raj_vue</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/raj_vue"/>
    <language>en</language>
    <item>
      <title>Scaling Vue.js for the Next Million: Lessons from 100k+ Concurrent User Environments</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Wed, 01 Apr 2026 10:30:14 +0000</pubDate>
      <link>https://forem.com/raj_vue/scaling-vuejs-for-the-next-million-lessons-from-100k-concurrent-user-environments-dh7</link>
      <guid>https://forem.com/raj_vue/scaling-vuejs-for-the-next-million-lessons-from-100k-concurrent-user-environments-dh7</guid>
      <description>&lt;p&gt;When you’re building a hobby project, Vue’s reactivity feels like magic. But when that project hits 100,000 concurrent users, that same magic can turn into a memory-leaking nightmare if your architecture isn't battle-hardened.&lt;/p&gt;

&lt;p&gt;Having spent 9+ years building full-stack applications with Vue and Laravel, I’ve seen exactly where "standard" patterns break under pressure. Scaling isn't just about adding more servers; it’s about writing code that respects the user's CPU and memory.&lt;/p&gt;

&lt;p&gt;Here is the blueprint for scaling Vue.js applications to handle enterprise-level traffic.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Reactivity Tax: Using shallowRef
In Vue 3, every reactive object is converted into a Proxy. For a small form, this is negligible. For a dashboard fetching 5,000 rows of data from a Laravel API, it’s a performance killer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Fix:&lt;br&gt;
If you have data that only needs to be displayed and not edited property-by-property, use shallowRef().&lt;/p&gt;

&lt;p&gt;JavaScript&lt;br&gt;
// Instead of this (Deep Reactivity):&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;largeData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;apiResponse&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;// Do this (Surface Reactivity):&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;largeData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;shallowRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;apiResponse&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why? This tells Vue not to observe every nested property. In a high-traffic app, this can reduce memory overhead by up to 40%.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DOM Management with Virtualization
Rendering 1,000 list items is easy. Rendering 1,000 items with complex components, images, and event listeners for 100k users will lag the browser's main thread.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Strategy: Stop rendering what the user can't see. By implementing Virtual Scrolling, you only render the 5–10 items currently in the viewport.&lt;/p&gt;

&lt;p&gt;Tool of choice: vue-virtual-scroller or VueUse/useVirtualList.&lt;/p&gt;

&lt;p&gt;The Result: Your DOM stays lean, regardless of whether your dataset has 10 or 10,000 entries.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Intelligent State Hydration (Pinia)
At 100k users, your API is under heavy load. If every page refresh triggers a full state fetch, your Laravel backend will struggle.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Strategy:&lt;/p&gt;

&lt;p&gt;Persisted State: Use Pinia with a LocalStorage or IndexDB plugin to cache non-critical data.&lt;/p&gt;

&lt;p&gt;Stale-While-Revalidate: Serve the cached state immediately while fetching fresh data in the background. This makes the app feel instant, even on slow connections.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Code Splitting: Beyond the Basics
Most developers know about lazy loading routes. But for true scale, you must split components and heavy libraries.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If only 5% of your users use the "Export to PDF" feature, don't make 100% of your users download the jspdf library.&lt;/p&gt;

&lt;p&gt;JavaScript&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="c1"&gt;// Lazy-load a heavy component only when needed&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PdfGenerator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineAsyncComponent&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./components/PdfGenerator.vue&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;The Backend Synergy: Laravel &amp;amp; Octane
You can't scale a Vue frontend if the API latency is high. For my high-traffic builds, I pair Vue with Laravel Octane.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By keeping the application in memory (using Swoole or RoadRunner), we eliminate the overhead of booting the framework on every request. This reduces API response times from 150ms to 20ms, allowing the Vue frontend to remain snappy and reactive.&lt;/p&gt;

&lt;p&gt;Summary: Performance is a Feature&lt;br&gt;
Scaling to 100k+ users isn't a single "hack." It's the sum of small, disciplined architectural choices:&lt;/p&gt;

&lt;p&gt;Respect the Proxy: Use shallowRef.&lt;/p&gt;

&lt;p&gt;Respect the DOM: Virtualize lists.&lt;/p&gt;

&lt;p&gt;Respect the Bundle: Async everything.&lt;/p&gt;

&lt;p&gt;Respect the Server: Optimize with Octane.&lt;/p&gt;

&lt;p&gt;Need to scale your application?&lt;br&gt;
I specialize in taking Vue.js and Laravel applications from "MVP" to "Enterprise Scale." If your app is slowing down or you're planning for massive growth, &lt;a href="https://realmind.in/" rel="noopener noreferrer"&gt;let’s connect.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Post-Publishing Tip: * Tags: #VueJS #WebPerformance #Laravel #Scaling #FullStack&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>javascript</category>
      <category>performance</category>
      <category>vue</category>
    </item>
    <item>
      <title>Passing Data to Child Components Without Props in Vue</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Thu, 10 Oct 2024 05:29:47 +0000</pubDate>
      <link>https://forem.com/raj_vue/passing-data-to-child-components-without-props-in-vue-4log</link>
      <guid>https://forem.com/raj_vue/passing-data-to-child-components-without-props-in-vue-4log</guid>
      <description>&lt;p&gt;When building Vue applications, the most common way to pass data from a parent component to a child component is via props. However, there are situations where you want to pass data to deeply nested child components without having to pass it through every intermediate component using props. This is where Vue's provide and inject pattern comes in handy.&lt;/p&gt;

&lt;p&gt;In this blog post, we’ll explore how you can pass data to child components using provide and inject, avoiding props entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Avoid Props?
&lt;/h2&gt;

&lt;p&gt;Props are great when data flows from parent to child directly. But as the component tree becomes more complex, passing props through multiple layers of components can become cumbersome. This pattern becomes problematic when:&lt;/p&gt;

&lt;p&gt;You have deeply nested components.&lt;br&gt;
Intermediate components don't need the data but must pass it along.&lt;br&gt;
You want to reduce boilerplate and avoid prop-drilling.&lt;br&gt;
Vue's provide and inject API offers a clean solution by letting you "provide" data in the parent and "inject" it directly into any descendant component without passing it down through props.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;How provide and inject Work&lt;/strong&gt;
&lt;/h2&gt;
&lt;h2&gt;
  
  
  provide
&lt;/h2&gt;

&lt;p&gt;The provide option is used to make data available to all descendant components. The parent component "provides" data by defining it inside the provide option.&lt;/p&gt;
&lt;h2&gt;
  
  
  inject
&lt;/h2&gt;

&lt;p&gt;The inject option allows child components to access the provided data. Any component that needs the data simply "injects" it without relying on the props system.&lt;/p&gt;

&lt;p&gt;Here’s an example to demonstrate how provide and inject work together.&lt;/p&gt;

&lt;p&gt;Example: Provide and Inject in Action&lt;br&gt;
Let’s walk through an example where a parent component provides a value and a child component consumes it via inject.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parent Component: Providing the Data
In your parent component, use the provide option to pass data.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;h1&amp;gt;Parent Component&amp;lt;/h1&amp;gt;
    &amp;lt;ChildComponent /&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import ChildComponent from './ChildComponent.vue';

export default {
  components: {
    ChildComponent
  },
  provide() {
    return {
      message: 'Hello from the Parent Component!'
    };
  }
}
&amp;lt;/script&amp;gt;

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

&lt;/div&gt;


&lt;p&gt;Here, we are using provide to share a message with the child components. Any descendant component can now access this message.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Child Component: Injecting the Data
&lt;/h2&gt;

&lt;p&gt;In the child component, use inject to access the provided data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;h2&amp;gt;Child Component&amp;lt;/h2&amp;gt;
    &amp;lt;p&amp;gt;Message: {{ message }}&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
export default {
  inject: ['message']
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this child component, we use inject to access the message provided by the parent. Notice that there's no need to pass message as a prop. The child component directly accesses the provided data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using provide and inject
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cleaner Code: You avoid prop-drilling, especially in deeply nested components.&lt;/li&gt;
&lt;li&gt;Flexible Data Flow: You can pass data to components that may not be direct children.&lt;/li&gt;
&lt;li&gt;Reduced Boilerplate: Fewer props means less code and reduced complexity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, it's important to note that provide and inject create an implicit dependency between components. If overused, this can make your component relationships harder to understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reactive Provide/Inject
&lt;/h2&gt;

&lt;p&gt;By default, provide does not react to changes in data. If you need the provided data to be reactive, you can wrap it in ref or reactive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;h1&amp;gt;Reactive Parent&amp;lt;/h1&amp;gt;
    &amp;lt;ChildComponent /&amp;gt;
    &amp;lt;button @click="updateMessage"&amp;gt;Update Message&amp;lt;/button&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import { ref } from 'vue';
import ChildComponent from './ChildComponent.vue';

export default {
  components: {
    ChildComponent
  },
  setup() {
    const message = ref('Hello from the Parent Component!');

    const updateMessage = () =&amp;gt; {
      message.value = 'Updated Message!';
    };

    return {
      provide: {
        message
      },
      updateMessage
    };
  }
}
&amp;lt;/script&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;Now, when the button is clicked, the message will be updated in both the parent and the child components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to Use provide and inject?&lt;/strong&gt;&lt;br&gt;
Global Configurations: When you need to pass down configuration or service instances (e.g., localization, theme settings, or API clients).&lt;br&gt;
&lt;strong&gt;Avoiding Prop-Drilling:&lt;/strong&gt; When you have deeply nested components and don't want to pass props through each layer.&lt;br&gt;
Shared State: When components need access to the same state but are not directly related in the component hierarchy.&lt;/p&gt;

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

&lt;p&gt;Vue’s provide and inject pattern is a powerful tool for sharing data between components without the hassle of prop-drilling. While it’s not a replacement for props, it's especially useful for managing complex component trees where intermediate components don’t need the data. By leveraging provide and inject, you can keep your codebase clean and maintainable, while efficiently passing data throughout your app.&lt;/p&gt;

&lt;p&gt;I hope this post helps you understand how to pass data between components without props using provide and inject. Happy coding!&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s Connect!
&lt;/h2&gt;

&lt;p&gt;I’d love to hear from you! Whether you have questions, need help with your projects, or just want to share ideas, feel free to reach out. Let’s connect and collaborate on building amazing things together.&lt;/p&gt;

&lt;p&gt;You can find me at &lt;a href="https://www.rajendranagar.co.in/" rel="noopener noreferrer"&gt;https://www.rajendranagar.co.in/&lt;/a&gt;, or connect with me on LinkedIn and GitHub to stay updated with the latest tips and insights.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Looking for Vue JS Project</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Mon, 25 Sep 2023 05:34:36 +0000</pubDate>
      <link>https://forem.com/raj_vue/looking-for-vue-js-project-4n6c</link>
      <guid>https://forem.com/raj_vue/looking-for-vue-js-project-4n6c</guid>
      <description>&lt;p&gt;Are you looking for a reliable Laravel and VueJS developer? With years of experience in PHP and Laravel, I can provide top-quality web development services, from building a website from scratch to upgrading an existing Laravel-based application. &lt;/p&gt;

&lt;p&gt;Here I created a new account let's discuss &lt;br&gt;
&lt;a href="https://www.fiverr.com/rajendra_nagar/laravel-vue-js-development" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Expertise&lt;br&gt;
    • Code refactoring &lt;br&gt;
    • Bug fixing &lt;br&gt;
    • REST APIs&lt;br&gt;
    • PHP Unit Testing&lt;br&gt;
    • VUEX (State Management)&lt;/p&gt;

&lt;p&gt;I use the following technology &lt;br&gt;
    1. PHP&lt;br&gt;
    2. Laravel&lt;br&gt;
    3. MySQL&lt;br&gt;
    4. JavaScript / jQuery&lt;br&gt;
    5. Vue Js&lt;/p&gt;

&lt;p&gt;I always Keep in my mind&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. 100% Client Satisfaction
2. Unlimited Revision to build a good relation
3. 100% Money-back Guarantee
4. Timely delivery of work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Found solution for UVC Quanta 0408:4033 camera PROBLEM Ubuntu 23</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Sun, 28 May 2023 11:02:08 +0000</pubDate>
      <link>https://forem.com/raj_vue/found-solution-for-uvc-quanta-04084033-camera-problem-ubuntu-23-5dj9</link>
      <guid>https://forem.com/raj_vue/found-solution-for-uvc-quanta-04084033-camera-problem-ubuntu-23-5dj9</guid>
      <description>&lt;p&gt;&lt;strong&gt;_Found  solution for UVC Quanta 0408:4033 camera PROBLEM Ubuntu 23 for the users Who are buying laptop Acer Aspire A715-51G and installed Ubuntu _&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Go to your home directory and follow steps&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I finaly compile https:/ on ubuntu 23.04
Simply by:
git checkout HEAD~1 (first commit for 6.2 kernel, last for 6.3 kernel)
make
sudo rmmod uvcvideo
sudo insmod ./uvcvideo.ko
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you found error like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.2.0-17ubuntu1) 12.2.0
You are using: gcc-12 (Ubuntu 12.2.0-17ubuntu1) 12.2.0
CC [M] /home/raj/uvc/uvc_driver.o
/home/raj/uvc/uvc_driver.c:17:10: fatal error: linux/usb/uvc.h: No such file or directory
17 | #include &amp;lt;linux/usb/uvc.h&amp;gt;
 ^~~~~~~~~~~~~~~~~
compilation terminated.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then follow below steps again&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install build-essential
git clone git clone  https://github.com/Kvalme/uvc.git
cd ./uvc/
git checkout 5ea688c
make
sudo rmmod uvcvideo
sudo insmod ./uvcvideo.ko

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

&lt;/div&gt;



&lt;p&gt;Now camera will work but if you reboot and again not working then run below command’s&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo cp /lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/uvcvideo.ko{,.back}

sudo cp ~/uvc/uvcvideo.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/uvcvideo.ko

sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please share or comment if you like may this can help to buy external webcam for the ubuntu users who are using this webcam&lt;/p&gt;

</description>
      <category>ubuntu</category>
    </item>
    <item>
      <title>How to change the timestamp column's format in Laravel?</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Sat, 17 Dec 2022 06:51:20 +0000</pubDate>
      <link>https://forem.com/raj_vue/how-to-change-the-timestamp-columns-format-in-laravel-3dla</link>
      <guid>https://forem.com/raj_vue/how-to-change-the-timestamp-columns-format-in-laravel-3dla</guid>
      <description>&lt;p&gt;If you want to compare the &lt;code&gt;timestamp&lt;/code&gt; column value with today's date then first you need to change the format of the &lt;code&gt;date-time&lt;/code&gt; value to the current date &lt;/p&gt;

&lt;p&gt;*&lt;em&gt;For example - *&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;find today's date data from the database table compare on the field &lt;code&gt;created_at&lt;/code&gt; which is the timestamp column type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$query-&amp;gt;where(name, $name)-&amp;gt;where(DB::raw("(DATE_FORMAT(date_time,'%Y-%m-%d'))"), 
Carbon::now()-&amp;gt;format('Y-m-d'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;DATE_FORMAT&lt;/code&gt; in &lt;code&gt;DB::raw&lt;/code&gt; to convert the &lt;code&gt;timestamp&lt;/code&gt; field into today's date and get data accordingly from the database.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>developme</category>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to create Nice table Component in Vue Js</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Sun, 11 Dec 2022 07:35:37 +0000</pubDate>
      <link>https://forem.com/raj_vue/how-to-create-nice-table-component-in-vue-js-dgo</link>
      <guid>https://forem.com/raj_vue/how-to-create-nice-table-component-in-vue-js-dgo</guid>
      <description>&lt;p&gt;Create new component &lt;code&gt;VueTableComponent.vue&lt;/code&gt; and insert following code below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div class="vue-nice-table table-responsive"&amp;gt;
    &amp;lt;table :class="[stripe ? 'table stripped' : 'table']"&amp;gt;
      &amp;lt;thead&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;th
            v-for="(column,key) in table_columns"
            :key="key"
            @click="sortFunction(column,key)"
          &amp;gt;
            {{ column.labelTop!==undefined? String(column.labelTop) : '' }} &amp;lt;br&amp;gt;
            {{ String(column.label) }}
            &amp;lt;i
              v-if="column.sorting!==false"
              :class="['fa',sortArrow(key)]"
              aria-hidden="true"
            /&amp;gt;
          &amp;lt;/th&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/thead&amp;gt;
      &amp;lt;tbody v-if="!table_rows.length"&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td colspan="9"&amp;gt;
            &amp;lt;slot name="emptystate" /&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/tbody&amp;gt;
      &amp;lt;transition-group
        v-if="table_rows.length"
        name="fade"
        tag="tbody"
      &amp;gt;
        &amp;lt;tr
          v-for="(row,key) in table_rows"
          :key="key+1"
          :class="{'highlight-row': highlightId === row.id}"
        &amp;gt;
          &amp;lt;td
            v-for="(column,key2) in table_columns"
            :key="key2"
          &amp;gt;
            &amp;lt;slot
              :row="row"
              :column="column"
              name="table-row"
            &amp;gt;
              {{ row[column.field] }}
            &amp;lt;/slot&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/transition-group&amp;gt;
      &amp;lt;tfoot v-if="Object.keys(footer_rows).length"&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;td
            v-for="(column,key2) in columns"
            :key="key2"
          &amp;gt;
            {{ footer_rows[column.field] }}
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/tfoot&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Styling the table view&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;style scoped&amp;gt;
.vue-nice-table .table td,
.table th {
  border-top-width: 0px;
  padding: 3px 5px !important;
  height: 40px;
  vertical-align: top !important;
}
.vue-nice-table .table td {
  border-bottom: 0;
}
.fade-enter-active, .fade-leave-active {
    transition: opacity .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
    opacity: 0;
}
.vue-nice-table .table th {
  border-bottom: 1px solid;
  border-color: #5e5e5e !important;
  font-weight: 800;
  color: #5e5e5e;
    white-space: nowrap;
}
.vue-nice-table .table tfoot {
  border-top: 1px solid #000000;
}
.vue-nice-table .table tfoot td {
  font-weight: 800;
}
.table-responsive::-webkit-scrollbar {
    -webkit-appearance: none;
}
.table-responsive::-webkit-scrollbar:horizontal {
    height: 8px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, .5);
    border-radius: 10px;
    border: 2px solid #ffffff;
}
.table-responsive::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: #ffffff;
}
.table-responsive table th{
    cursor: pointer;
}
.vue-nice-table .stripped tbody tr:nth-child(odd) {
   background-color: #eee !important;
}
.highlight-row {
    box-shadow: inset 0px 0px 10px 0px #f39c12;
}
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define props&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;props: {
        columns: { type: Array, default: () =&amp;gt; [] },
        rows: { type: Array, default: () =&amp;gt; [] },
        footer: { type: Object, default: () =&amp;gt; {} },
        sortByApi: { type: Boolean, default: false},
        stripe: { type: Boolean, default: false},
        highlightId: { type: Number, default: 0},
    },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define data properties&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data() {
        return {
            sorted_rows: [],
            column_arrows_index:null,
            column_arrows_sort:'asc',
        };
    },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Computed properties&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;computed: {
        table_columns() {
            return this.columns.filter(node=&amp;gt;node.show!==false);
        },
        table_rows() {
            let rows = [];
            if (this.sortByApi) {
                rows = this.rows;
            } else {
                rows = this.sorted_rows.length === this.rows.length ? this.sorted_rows : this.rows;
            }
            return rows.length ? rows.map(node =&amp;gt; {
                return this.formatRow(node, 'row');
            }) : [];
        },
        footer_rows() {
            var footer_rows = this.footer !== undefined ? [this.footer] : [];
            footer_rows = footer_rows.map(node =&amp;gt; {
                return this.formatRow(node, 'footer');
            });
            return footer_rows.length ? footer_rows[0] : {};
        },
        column_arrows(){
            return this.columns.map((node,index)=&amp;gt;{
                return index===this.column_arrows_index ? this.column_arrows_sort : 'none';
            });
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define some logic and calculations&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;watch: {
        rows(oldVal, newVal) {
            if (oldVal !== newVal &amp;amp;&amp;amp; !this.sortByApi) {
                this.sortFunction(this.table_columns[0],0);
            }
        }
    },
    mounted(){
        if(this.rows.length &amp;amp;&amp;amp; this.sorted_rows.length===0){
            this.sortFunction(this.table_columns[0],0);
        }
    },
    methods: {
        ucfirst(string) {
            return string.charAt(0).toUpperCase() + string.slice(1);
        },
        sortFunction(column, index) {
            if(column.sorting===false){
                return false;
            }
            let type = column.type !== 'undefined' ? column.type : 'string';
            //toggle sorting
            if(this.column_arrows_index === index){
                this.column_arrows_sort = this.column_arrows_sort === 'desc' ? 'asc' :'desc';
            }else{
                this.column_arrows_index = index;
                this.column_arrows_sort = 'asc';
            }
            if (this.sortByApi) {
                this.$emit('sort', column.field, this.column_arrows_sort, type);
            }
            this.sorted_rows = this.rows.sort(this.compareValues(column.field, this.column_arrows_sort, type));
        },
        sortArrow(key)
        {
            if (this.column_arrows[key]==='asc')
            {
                return  'fa-caret-down';
            }
            else if (this.column_arrows[key]==='desc')
            {
                return  'fa-caret-up';
            }
            else
            {
                return  'fa-sort';
            }
        },
        compareValues(key, order = 'asc', type = 'string') {
            return function(a, b) {
                if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
                    // property doesn't exist on either object
                    return 0;
                }
                var varA;
                var varB;
                switch(type){
                case 'string':
                    varA = String(a[key]).toUpperCase();
                    varB = String(b[key]).toUpperCase();
                    break;
                case 'float':
                    varA = (Math.round(parseFloat(a[key])*100)/100);
                    varB = (Math.round(parseFloat(b[key])*100)/100);
                    break;
                default:
                    varA = a[key];
                    varB = b[key];
                }
                let comparison = 0;
                if (varA ===null || varA ==='' || varA==='-') {
                    comparison = 1;
                }
                else if (varB ===null || varB ==='' || varB==='-') {
                    comparison = -1;
                }else{
                    if (varA &amp;gt; varB) {
                        comparison = 1;
                    } else if (varA &amp;lt; varB) {
                        comparison = -1;
                    }
                }
                return order === 'desc' ? comparison * -1 : comparison;
            };
        },
        formatRow(row, type = 'row') {
            let new_row = {};
            this.columns.map(column =&amp;gt; {
                //replace undefined value with empty string
                if (typeof(row[column.field]) === undefined) {
                    new_row[column.field] = '';
                    return false;
                }
                //check if footerFormat is available in case of footer
                if (type === 'footer') {
                    if (
                        column.footerFormat === undefined &amp;amp;&amp;amp;
            column.footerFormat !== false
                    ) {
                        new_row[column.field] = row[column.field];
                        return false;
                    }
                }
                //format row cell w.r.t column field type if given
                if (column.type === 'number') {
                    if(row[column.field]){
                        new_row[column.field] = parseInt(row[column.field], 10);
                    }else {
                        new_row[column.field] = '-';
                    }
                } else if (column.type === 'float' &amp;amp;&amp;amp; row[column.field]) {
                    if (typeof column.decimalPoint !== 'undefined') {
                        new_row[column.field] = parseFloat(row[column.field]).toFixed(
                            column.decimalPoint
                        );
                    } else {
                        new_row[column.field] = parseFloat(row[column.field]).toFixed(2);
                    }
                } else if (column.type === 'date' &amp;amp;&amp;amp; row[column.field]) {
                    // if (typeof column.dateFormat !== 'undefined') {
                    //  new_row[column.field] = this.$moment(row[column.field]).format(
                    //      column.dateFormat
                    //  );
                    // } else {
                    //  new_row[column.field] = this.$moment(row[column.field]).format(
                    //      'YYYY-MM-DD'
                    //  );
                    // }
                } else if (column.type === 'percentage') {
                    if(row[column.field]!==null){
                        new_row[column.field] = parseInt(row[column.field] * 100 ) + '%';
                    }else {
                        new_row[column.field] = '-';
                    }
                } else if (column.type === 'string') {
                    if (typeof column.stringFormat !== 'undefined') {
                        if (column.stringFormat === 'uppercase') {
                            new_row[column.field] = String(row[column.field]).toUpperCase();
                        } else if (column.stringFormat === 'ucfirst') {
                            new_row[column.field] = this.ucfirst(String(row[column.field]));
                        } else {
                            new_row[column.field] = String(row[column.field]).toLowerCase();
                        }
                    } else {
                        new_row[column.field] = String(row[column.field]);
                    }
                } else {
                    new_row[column.field] = row[column.field];
                }
            });
            return Object.assign(Object.assign({}, row), new_row);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create new component and import table component  and use  as below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;vue-table-component
    :columns="columns_array"
    :rows="rows_array"
    :footer="footer_object"
    :stripe="false"
 /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use slot for linking the row&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;vue-table-component
    :columns="columns"
    :rows="rows"
&amp;gt;
    &amp;lt;template
        slot="table-row"
        slot-scope="props"
    &amp;gt;
        &amp;lt;span v-if="props.column.field==='full_name'"&amp;gt;
            &amp;lt;a
                :href="'/profile/'+props.row.user_id"
                class="text-underline"
            &amp;gt;{{ props.row['full_name'] }}&amp;lt;/a&amp;gt;
        &amp;lt;/span&amp;gt;
        &amp;lt;span v-else&amp;gt;
            &amp;lt;span
                v-if="props.row.average_score&amp;lt;5"
                class="text-warning"
            &amp;gt;{{ props.row[props.column.field] }}&amp;lt;/span&amp;gt;
            &amp;lt;span v-else&amp;gt;{{ props.row[props.column.field] }}&amp;lt;/span&amp;gt;
        &amp;lt;/span&amp;gt;
    &amp;lt;/template&amp;gt;
    &amp;lt;template slot="emptystate"&amp;gt;
        No data present.
    &amp;lt;/template&amp;gt;
&amp;lt;/vue-table-component&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sorting using API&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;vue-table-component
    :columns="columns"
    :rows="rows"
    :sort-by-api="true"
    @sort="sortFunction('custom_argument',...arguments)"
&amp;gt;

&amp;lt;/vue-table-component&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;Call sort function &lt;br&gt;
&lt;code&gt;sortSessions(custom_argument,sortBy,sortType){&lt;br&gt;
    Call your api to sort&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to remove trailing commas from the last element of an array using JavaScript?</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Sun, 11 Dec 2022 07:00:46 +0000</pubDate>
      <link>https://forem.com/raj_vue/how-to-remove-trailing-commas-from-the-last-element-of-an-array-using-javascript-4jme</link>
      <guid>https://forem.com/raj_vue/how-to-remove-trailing-commas-from-the-last-element-of-an-array-using-javascript-4jme</guid>
      <description>&lt;p&gt;To remove the comma from an array's last element, call the replace() method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let array = ['value1', 'value2', 'value3', 'value4', 'value5,'];
    let last_index = array.length-1;
    let last_value = array[last_index].replace(',', '');
    array[last_index] = last_value;
   console.log(array);
   //Output
   ['value1', 'value2', 'value3', 'value4', 'value5']
&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%2Fuploads%2Farticles%2Fy4tg1lbbmzaodecsgjmw.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%2Fuploads%2Farticles%2Fy4tg1lbbmzaodecsgjmw.png" alt="Image description" width="800" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find the last element from an array using length.
&lt;code&gt;array.length-1;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Replace comma using replace method and filter new value
&lt;code&gt;array[last_index].replace(',', '');&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Push new value at last element index 
&lt;code&gt;array[last_index] = last_value;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Output will be &lt;br&gt;
&lt;code&gt;//Output&lt;br&gt;
   ['value1', 'value2', 'value3', 'value4', 'value5']&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to use Vuelidate forEach helper to validate collections in Vue Js</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Fri, 25 Nov 2022 05:43:11 +0000</pubDate>
      <link>https://forem.com/raj_vue/how-to-use-vuelidate-foreach-helper-to-validate-collections-in-vue-js-26c5</link>
      <guid>https://forem.com/raj_vue/how-to-use-vuelidate-foreach-helper-to-validate-collections-in-vue-js-26c5</guid>
      <description>&lt;p&gt;Using the forEach helper from &lt;strong&gt;@vuelidate/validators&lt;/strong&gt; , you can easily validate all properties inside a collection, without any extra components.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div
    v-for="(input, index) in state.collection"
    :key="index"
    :class="{
        error: v$.collection.$each.$response.$errors[index].name.length,
      }"
  &amp;gt;
    &amp;lt;input v-model="input.name" type="text" /&amp;gt;
    &amp;lt;div
      v-for="error in v$.collection.$each.$response.$errors[index].name"
      :key="error"
    &amp;gt;
      {{ error.$message }}
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
// setup in a component
import { helpers, required } from '@vuelidate/validators'
import { useVuelidate } from '@vuelidate/core'
import { reactive } from 'vue'

export default {
  setup () {
    const rules = {
      collection: {
        $each: helpers.forEach({
          name: {
            required
          }
        })
      }
    }
    const state = reactive({
      collection: [
        { name: '' }, { name: 'bar' }
      ]
    })
    const v = useVuelidate(rules, state)
    return { v, state }
  }
}

&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The $response for the validator follows the schema below, so you can use it as you wish:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const result = {
  $data: [
    {
      propertyToValidate: {
        validator: boolean,
      }
    },
  ],
  $errors: [
    {
      propertyToValidate: [
        {
          $message: string, // the validator error
          $model: '', // the model that was validated
          $params: {}, // params, if validator has any
          $pending: false, // always false, no async support.
          $property: string, // the property to validate
          $response: boolean, // response
          $validator: string // validator name
        },
      ]
    },
    {
      name: []
    }
  ],
  $valid: boolean
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>github</category>
    </item>
  </channel>
</rss>
