Misunderstanding variable scope in JavaScript
In this post, we are going to understand variable scope and difference between var, let and const keywords in javascript. Variable scope is tricky concept for new developers., especially in javascript. Most of beginner developers make common mistake like defining the variable inside the function and expecting it to access outside the function. Understanding var,…
Using index as a key in React (anti-pattern)
What are lists in React ? Lists are used to display data which are similar in ordered format . Often they have same type i.e an array of similar kind of data rendered into a list tag using some version of for loop. How does react render lists? DOM Before we learn how react renders lists…
Object references and copying
One of the fundamental differences of objects versus primitives is that objects are stored and copied “by reference”, whereas primitive values: strings, numbers, booleans, etc – are always copied “as a whole value”. That’s easy to understand if we look a bit under the hood of what happens when we copy a value. Let’s start…
Introducing constructors
If we need to create multiple object of same shape then one of the way to define the shape of is by using the function. we have to create an empty object, initialize it, and return it. A better way is to use a constructor. A constructor is just a function called using the new keyword. When…
Scheduling: setTimeout and setInterval
We may decide to execute a function not right now, but at a certain time later. That’s called “scheduling a call”. There are two methods for it: These methods are not a part of JavaScript specification. But most environments have the internal scheduler and provide these methods. In particular, they are supported in all browsers…
Utility Types in TypeScript
What are utility Types? In TypeScript, utility types are built-in types that allow you to manipulate and transform existing types. They can be used to extract, exclude, or modify the properties of an existing type, or to create a new type based on an existing one. TypeScript provides several utility types to facilitate common type…
Function in JavaScript
A function in JavaScript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output. We can separate function in…
Stripe Payment with Golang
In this blog post, I will discussed on the topic of stripe payment integration with Golang. Before that i will give brief introduction about this and move head to simple implementation. It is a famous payment gateway that helps in financial transaction between merchants and customers. It accepts 133+ countries currency. It is a powerful…
Common Anti-patterns with React
Nested components When a component is defined inside another component, it creates a tight coupling between the two components, meaning that they are highly dependent on one another. This can make it difficult to reuse or re purpose the inner component. Also when the parent component re-renders , the inner component will be defined again…