Category: CodeMoments

We help you to enjoy every moment of Coding. Let’s Dive In

November 3, 2022 / ReactJS

JSX is a syntax extension to Javascript but doesn’t it look like HTML? That’s the first question you will ask yourself when you see JSX code or any standard react template. It’s technically not HTML but to save you from the complexity you can say it is inspired by HTML.…

October 4, 2022 / ReactJS

Unit testing is an important part of the Software development life cycle and unit tests are written and executed by developers in which the smallest testable units of the code are tested to check whether the individual functionality is working as intended. The main aim of unit testing is to…

June 25, 2022 / Javascript

Looping is an important concept in programming. Every language has its own set of predefined looping functions that allows you to iterate over a given set of data. Javascript is no different. Filter, Map, Reduce and Foreach are widely used by javascript programmers. And often end up becoming part of…

April 5, 2022 / CodeMoments

next-cookies is not just an npm package. It’s a life saviour. This package solved a big problem that NextJS developer faced. Browser storage in all SSR, SSG functions. The most common use case for accessing cookies in getServerSideProps is when you want to fetch data from an API that requires…

January 24, 2022 / CodeMoments

Event Propagation is simply the ways by which order an event is captured by browser in an HTML page where elements are nested. There are basically two types of event propagation bubbling and capturing. In event bubbling the event of the innermost element is captured first while in event capturing…

January 7, 2022 / postgreSQL

Relation of column not defined is a pretty common error in postgresql and nodejs servers. Especially, beginners fail to understand and resolve this error. When you make any changes to your schema in nodejs it doesn’t reflect into postgresql db like in mongodb. You need to manually update the table…

October 31, 2021 / ReactJS

Sometimes while exporting components and functions in react you might face an error “Object is not a function”. The clear meaning to this error is that something in your code that you are trying to use as a function is an object. When you face this error the first thing…

September 7, 2021 / MongoDB

$or operator in mongoose is used to perform a logical OR operation on an array of expressions. It helps you in situations when you need to find documents with multiple conditions. Such as creating a search with multiple parameters. It accepts an array of expressions and returns all the documents…

July 5, 2021 / MongoDB

In situations where you need to get documents excluding some specific values, as a beginner, you will extract all documents and use javascript to filter. But that’s not the ideal way to do this. MongoDB gifted us with a really powerful operator that can help us make a mongo query…

June 10, 2021 / CodeMoments

Population or Query Population in mongoose is a process of automatically replacing paths with other documents from other collections in a single document, multiple documents, objects, multiple objects. That’s the official definition of the population by a mongoose. But, most of us would understand this one: “Population is simply a…