JavaScript

12th November 2024

Five Ways to Lazy Load Images for Better Website Performance

Lazy loading images can improve website performance by loading images asynchronously. Images have become one of the most used types of content in modern web applications. Although using background images improves the application’s look and feel, increasing image sizes can significantly impact application performance.   Even when properly optimized, images can weigh quite a bit and keep users waiting to access content on your website. Often, they get impatient and navigate somewhere else unless you come up with a solution to image loading that doesn’t interfere with the perception of speed. In this article, you’ll learn about five approaches to lazy loading […]
5th November 2024

Choosing Between type and interface in React

However, as I delved deeper into React and wrestled with complex projects, I realized that the ‘interface as default’ approach wasn’t always fitting. My explorations and projects led me to question that initial guidance. After years navigating the React trenches and countless hours of research, I’ve come to understand that the choice between “type” and “interface” isn’t black and white. The real answer is, it depends. If you’re using TypeScript with React, pondering whether to use “type” or “interface” to define your prop types, you’re not alone. Both have unique advantages and applications in the ever-evolving landscape of React development. […]
10th October 2024

JavaScript Date VS Moment.js

How to Create a Date Object Get the current date and time Get a date and time with individual values The syntax is Date(year, month, day, hour, minute, second, millisecond). Note that the months are zero-indexed, beginning with January at 0 and ending with December at 11. Get a date and time from a timestamp This represents the time at Thursday, January 1st, 1970 (UTC), or the Unix Epoch time. The Unix Epoch is important because it’s what JavaScript, Python, PHP, and other languages and systems use internally to calculate the current time. new Date(ms) returns the date of the epoch plus the number […]
7th October 2024

How to Work with useMemo in React – with Code Examples

useMemo is a valuable tool in the React framework, designed to optimize performance by memoizing expensive computations. With useMemo, React can store the result of a function call and reuse it when the dependencies of that function haven’t changed, rather than recalculating the value on every render.  useMemo stands out as a powerful tool for optimizing performance without sacrificing code readability or maintainability. But it’s often overlooked or misunderstood by beginners.  In this comprehensive guide, we’ll discuss what useMemo is, how it works, and why it’s an essential tool for every React developer. What is useMemo? useMemo is a handy tool in React that helps make […]
31st August 2024

Release React Native 0.75

The release of React Native 0.75 marks a significant milestone with a series of impactful updates and changes aimed at improving performance, stability, and the overall developer experience. Below, we provide a comprehensive overview of the enhancements, new features, and breaking changes included in this version. For those interested in the previous version, you can review the details of React Native 0.74 by visiting the following link: Release React Native 0.74.0. Highlights 🚀 Enhancements in Yoga 3.1 and Layout Improvements React Native 0.75 includes Yoga 3.1, which brings several enhancements and new layout capabilities. One of the key highlights is the support […]
6th August 2024

Axios vs. Fetch API: Selecting the Right Tool for HTTP Requests

Axios vs. Fetch API know the key difference : In the field of software development, the ability to seamlessly interact with remote servers and exchange data over the web is very important. Whether it’s fetching data from an API, performing CRUD operations, or executing any other network-related task, the significance of making HTTP requests cannot be overstated. Two widely used JavaScript libraries, Fetch and Axios, have become top picks for developers seeking to handle HTTP requests. Axios and Fetch to see how they can be used to perform different tasks. Hopefully, by the end of the article, you’ll have a […]
6th July 2024

Difference between JavaScript and TypeScript

JavaScript JavaScript is the most popular programming language of HTML and the Web. JavaScript is an object-based scripting language which is lightweight and cross-platform. It is used to create client-side dynamic pages. The programs in JavaScript language are called scripts. The scripts are written in HTML pages and executed automatically as the page loads. It is provided and executed as plain text and does not need special preparation or compilation to run. History of JavaScript Netscape Communications Corporation programmer Brendan Each developed JavaScript. It was introduced in September 1995, which was initially called Mocha. However, after gaining popularity as the […]
12th April 2024

5 Different Ways to Declare Functions in jQuery

Choosing which way to declare a JavaScript function can be confusing for beginners and there are several different syntax options. Each has advantages, disadvantages, and appropriate uses that can catch you out. In this article, we examine several ways to define a block of JavaScript functionality. 1. Regular JavaScript Functions The first and most obvious way to declare a function in JavaScript is to use a function declaration. A function named multiply(), which takes two parameters x and y, multiplies them, and returns the value can be implemented with the following syntax: Functions defined in this way (a function declaration) are hoisted to the top of the current […]
23rd June 2023

Hyperledger Composer Architecture

Hyperledger Composer is an open framework device to make blockchain programs efficient to a large extent. It linked the blockchain application with the records of business systems. It allows the developers to create full-stack blockchain application solutions. It uses the Hyperledger Fabric architecture to enable the protocols and policies and to have verified transactions. The current business network can be easily monitored by Hyperledger Composer which can include the assets, services, property, etc. Key Concepts in Hyperledger Composer Below are some of the concepts in Hyperledger Composer: Architecture of Hyperledger Composer Below are some of the components of Hyperledger Composer: 1. Yeoman code generator: 2. […]
4th May 2023

Cookies vs. Local Storage vs. Session Storage: What’s the difference?

Cookies, Local Storage, and Session Storage are the storage methods in javascript. We’ll take a look at some examples and explore their differences. Cookies, Local Storage, and Session Storage Cookies are small pieces of data stored on the client-side computer, usually in plain text. A cookie is typically sent to the server with each request so that the server can identify the user and provide personalized content. Cookies are typically used for authentication and storing user preferences. Local storage is similar to cookies, but it stores data in a structured way, usually as key-value pairs. The data is stored on the client-side […]
14th April 2023

Configure ESLint, Prettier, and Flow in VS Code for React Development

This short guide will provide you a consistent and reusable development workflow for all React Native projects. The more effort you put into writing quality code, the less time you spend on debugging. You can increase your code quality and reduce the time spent on debugging with a consistent development workflow. In this guide I will show you how to configure your editor to handle your code formatting, linting, and type checking. Test Driven Development and a preconfigured build configuration are recommended. I won’t go into much detail on either of these. I recommend create-react-app for the web and using the React Native […]
10th October 2022

Quick Tip : How to Use the Spread Operator in JavaScript

Symbolized by three dots (...), the JavaScript spread operator was introduced in ES6. It can be used to expand elements in collections and arrays into single, individual elements The spread operator can be used to create and clone arrays and objects, pass arrays as function parameters, remove duplicates from arrays, and more Syntax The spread operator can only be used on iterable objects. It must be used right before the iterable object, without any separation. For example: Function Parameters Take as an example the Math.min() method. This method accepts at least one number as a parameter and returns the smallest […]