[Solved] Attempted import error: ‘Switch’ is not exported from ‘react-router-dom’

Javascript on MoreOnFew.com

You might be facing an “Attempted import error: ‘Switch’ is not exported from ‘react-router-dom’ ” error if you are using the react-router-dom package version 6. This error is caused due to using the older switch syntax of the react-router-dom. From version 6 onwards, the react-router-dom has replaced “Switch” with “Routes”. Let us take a look … Read more

How to get current url in JavaScript?

Javascript on MoreOnFew.com

JavaScript has come a long way since its inception. I remember the days when it was mainly used only for form validations. Now we use JavaScript for a lot more functionalities. JavaScript has a vast number of APIs which enables us to access a variety of features and information from the browser. One such API … Read more

How to install specific version of npm package?

Javascript on MoreOnFew.com

As you might already know, there are a large number of npm packages released every day. An equally large number of updates too get released on the npm registry. While we would like to keep the dependencies in package.json updated to the latest version most of the time, there are still times when we would … Read more

Know the difference between tilde and caret in package.json

Javascript on MoreOnFew.com

Most of us might have wondered what does the tilde (~) and caret (^) prefixing the version number of the “dependencies” in your package.json file mean. Well, it is important to know the difference between tilde and caret in package.json as the wrong usage can even break your project. Understanding the usage of tilde (~) … Read more

How to find unused dependencies in npm?

Javascript on MoreOnFew.com

NPM has become the most popular package manager over time. It is really helpful and useful to manage the package dependencies of your project. However, over time, as your project keeps growing and new packages get released, there are times when we move on to a better alternative of a package or even stop using … Read more

Uncaught SyntaxError: Unexpected end of input – Causes And Fix!

Javascript on MoreOnFew.com

I know that sometimes the errors we face in JavaScript can be difficult to debug. While with all the modern tools like Chrome developer tools etc the debugging has become far easier, there still are times when we come across issues that are tricky to debug. One such issue is the “Uncaught SyntaxError: Unexpected end … Read more

How to replace text in JavaScript

Javascript on MoreOnFew.com

Working with text or strings in JavaScript is really interesting. In fact text or “String” as it is called in JavaScript is the most common data type that a JavaScript programmer would encounter quite often. And many a times your would come across scenarios where you might have to replace a text in JavaScript. Thankfully, … Read more

What is the difference between Number.isInteger() and Number.isSafeInteger() in JavaScript ?

Javascript on MoreOnFew.com

As a part of ES6 (also known as ECMAScript 2015 or ECMAScript 6), there are a couple of new JavaScript features and methods introduced. Today we would be concentrating on just two of them i.e Number.isInteger() and Number.isSafeInteger(). What is Number.isInteger() ? The Number.isInteger() is a new method of the Number object introduced as a … Read more