In this post I try to identify some of the Gang of Four (GOF) design patterns used, or can be used, in React JS applications. Most patterns I list down are not strictly React's, but belong to JavaScript, so they're equally applicable in other frameworks too, such as Vue and Angular.
[Read More]Javascript Track User Activity on Webpage With Custom Script
Time Spent, User Country, Scrolling, Mouse & Button Clicks, Mouse Movement, and Key Presses
In this post, we create a custom JavaScript front-end script to track user activity on a webpage.
[Read More]How to Extract Numbers From a String in JavaScript
Including decimals, negatives, and numbers with commas.
While working on certain tasks with JavaScript, such as web scraping, we might need to extract specific data from a string, such as uppercase words or numbers. In this post, I am going to address numbers.
The numbers may also be:
[Read More]
JavaScript Inheritance and Polymorphism in React JS Application
The React JS documentation emphasizes on using composition over inheritance for components, as there is hardly any scenario that requires component inheritance. However, that does not stop us from using inheritance and polymorphism within our JavaScript code. To explain, we discuss one such example below by using es6 classes:
[Read More]
Serialize and Deserialize JavaScript Class Objects In Front End Applications
The drawback of using JavaScript classes in your frontend application is that we cannot pass it to or receive it from the backend as class object. We need to serialize and deserialize it.
[Read More]JavaScript Get Information of Week Days Between Two Dates
With and Without Moment JS
Requirement: Given a start and end date, we need to find out which days of the week exist between them i.e. Sun, Mon, Tue, Wed, Thu, Fri, Sat (in numbers: 0, 1, 2, 3, 4, 5, 6). We might also want to count them, or we may only be interested if weekends exist.
[Read More]
How to Add Full Calendar Icon to Monthly View Grid?
With and Without dayCellDidMount hook
To add an icon to a day, we need to identify the grid we want to add an icon to. For instance, today, past days, future days, weekends only, etc. Then we add the icon through JavaScript.
There are two ways to do that:
[Read More]Countries JSON Dictionary, Map Code to Name and Name to Code
Of Over 240 Countries
Below are two JSON dictionaries and an array of countries. First dictionary maps country codes to country names. The other maps the same names to their codes. The array at the end has objects of countries.
The source of the data is this github gist.
[Read More]
What Are The Use Cases of Lodash Chunk method?
Chunk is a method of Lodash that splits the array into evenly sized arrays and returns them in a single array. If the array is indivisible evenly, the final chunk has the left over elements. It takes the size of the grouping in argument (the default size is 1).
[Read More]
Redux Form Render Multiple FieldArray Dynamically on the Same Page, With Validation
Redux Form comes with an option to use fieldArray and render a group of fields dynamically. But what if we want to render multiple fieldArray on the same page?
For example: In a form, we want to show 7 week days, and each week day can have as many events as user wants.
[Read More]
When you purchase through links on techighness.com, I may earn an affiliate commission.