Mastering useCallback in React

Introduction React has revolutionized the way we build user interfaces, and its hooks API has made state management and side effects more intuitive. However, as applications grow, performance can become a bottleneck. One tool in React’s optimization toolbox is the useCallback hook. In this article, we’ll explore what useCallback is, when to use it, and… Continue reading Mastering useCallback in React

Published
Categorized as JavaScript

A Practical Example Of useMemo

Let’s say you’re building a dashboard that filters a list of users based on a search term. Without useMemo, the filtering logic might run on every render, even if the data or search term hasn’t changed. Here’s how you might implement this without useMemo: import React, { useState } from ‘react’; function UserList({ users })… Continue reading A Practical Example Of useMemo

Published
Categorized as JavaScript

Function To Render the Data in Table Structure Using HTML

The function in the javascript is used to display the sales order items in a table structure. <script>       let removedItems = [];       let addedItems = [];       let deleteSOPersmissionFlag = “${deleteSOPersmission}”;       document.addEventListener(“DOMContentLoaded”, function () {         let scanButton = document.getElementById(“scanItemBtn”);         let fetchButton = document.getElementById(“fetchItemBtn”);         let saveButton = document.getElementById(“savebutton”);         let deleteBtn = document.getElementById(“deleteOrderBtn”);         const cancelOrder = document.getElementById(“cancelBtn”);         if… Continue reading Function To Render the Data in Table Structure Using HTML

Published
Categorized as JavaScript

Some JavaScript functions that can significantly optimize the primitive approaches programmers might use for certain tasks:

reduce const numbers = [10, 20, 30]; const sum = numbers.reduce((total, num) => total + num, 0); console.log(sum); // 60 fromEntries const obj = { a: 1, b: 2, c: 3 }; const transformed = Object.fromEntries(   Object.entries(obj).map(([key, value]) => [key, value * 2]) ); console.log(transformed); // { a: 2, b: 4, c: 6 }… Continue reading Some JavaScript functions that can significantly optimize the primitive approaches programmers might use for certain tasks:

jQuery to disable button action

To disable a button action using jQuery, you can set the attribute of the button to . Here’s a simple example: jQuery(‘#button_id’).prop(‘disabled’, ‘disabled’);

How Async/Await Can Slow Down Your Node.js App

n the world of Node.js, async/await has become a staple for handling asynchronous operations. It’s clean, easy to read, and feels synchronous. But as wonderful as it sounds, misusing async/await can introduce performance bottlenecks that slow down your application. If your app feels sluggish despite using async/await, this post is for you. Why Async/Await Feels Slow Under the hood,… Continue reading How Async/Await Can Slow Down Your Node.js App

Built-in WebSockets in Node.js

WebSockets are essential for building real-time applications, enabling two-way communication between a client and a server. Whether you’re working on a chat app, stock market ticker, or a collaborative tool, WebSockets allow your server and client to stay connected and send data in real-time. As of 2024, Node.js continues to make it easier to work with WebSockets, especially with the… Continue reading Built-in WebSockets in Node.js

Intro to Node’s built-in SQLite module

SQLite in Node makes it easier than ever to persist data with server-side JavaScript. Get started with the node:sqlite module. Credit: iStock Node 22.5.0 now bundles SQLite, a lightweight, in-process relational database that requires no additional infrastructure but packs considerable capability. Let’s get to know this handy new built-in feature in Node.js. What is SQLite? Relational databases are a… Continue reading Intro to Node’s built-in SQLite module

Node.js performance hooks and measurement APIs

You’ve written and deployed your application and gathered users – congrats! But what’s next? Improvements, getting rid of bottlenecks, increasing execution speed, and more enhancements are in line. In order to make these improvements, you first have to be aware of your app’s existing performance characteristics. Only when you’ve identified the slow parts and the… Continue reading Node.js performance hooks and measurement APIs