Next.js

Next.js getServerSideProps(): Tutorial & Example

Updated: March 22, 2023 By: Goodman

Overview getServerSideProps() is a Next.js asynchronous function that can be exported from a page component (in your pages folder) to fetch data at the requested time on the…

How to Upgrade an Existing Next.js Project

Updated: April 27, 2023 By: Goodman

This article will show you how to upgrade an existing Next.js project to the latest version. This will ensure that your application is secure, performs well, and is…

Next.js: How to set HTML lang attribute

Updated: June 8, 2023 By: Khue

When building a web application, you can set the lang attribute of the <html> tag to explicitly declare the language used on your pages. For example, an app…

Next.js API Routes: How to Get Parameters & Query String

Updated: January 14, 2023 By: Khue

With Next.js, you can build your backend API right in the pages/api directory of your project. Suppose you want to fetch data about some fictional products from your…

Next.js: How to Disable/Enable React Strict Mode

Updated: January 14, 2023 By: Khue

React Strict Mode is a tool that runs in development mode only. It checks and highlights potential issues in your application, such as unsafe lifecycles, legacy API usage,…

Next.js: How to Get User’s IP Address

Updated: January 14, 2023 By: Khue

There might be cases where you want to get the IP address from where the user is viewing the current page of your Next.js app (e.g., you want…

How to Run Next.js on Custom Ports

Updated: January 14, 2023 By: Goodman

By default, a Next.js app will run on port 3000 (both in the development and production environments). However, you can use another port if you like. This short…

Solving the ‘Window is Not Defined’ Error in Next.js

Updated: January 10, 2023 By: Goodman

This article shows you a few solutions to fix the window is not defined error in Next.js. Understanding The Problem When working with Next.js, you are likely to…

How to Detect Server vs Client Environment in Next.js

Updated: January 10, 2023 By: Goodman

In Next.js, you can programmatically detect between the server environment and the client environment by checking whether the window object exists or not, like this: Because the window…

Next.js: 2 ways to fix the ‘document is not defined’ error

Updated: January 9, 2023 By: Frienzied Flame

When working with Next.js, you might encounter the document is not defined error. This article will explain why this error happens, then walk you through a couple of…

1 6 7 8 9 10 11