Skip to content

Tag: next.js

NextJS – Appending a query param to a dynamic route

In my NextJS app, I have a language selector that’s visible on every page. When I select a new language, I just want to replace the current URL by appending a query param lang=en to it. Here’s the function that replaces the URL: In this example, replace, query and pathname are coming from the next…

Importing SVG in NextJS

I am trying to import an svg within a NextJS project, everytime I get this error I have tried using next-images and also svgr. I will paste my About.js code below, it would be excellent if someone could let me know what I have been doing wrong. Answer Using next-images and adding the correct module exports al…

NextJS deploy to a specific URL path

I am working on my first NextJS application. When I run “npm run dev” or “npm run start” it deploys my application to When I navigate to a page the url becomes I need to have my own specific URL, such as Furthermore, my app has a lot of elements to link to other areas of the applicatio…

How to Set port in next.js

one application is running on port 3000 and I want to run another application on a different port of the default port. How I change this in React Next.js. My package.js script is and start script command is npm run dev Answer This work for me

I can’t reference an image in Next.js

I have a React component that’s being used in Next.js page: /pages/index.js In Main.js I have the following code I get the following error Module parse failed: Unexpected character ‘�’ (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to p…