How to Fix “Missing Key Prop For Element in Iterator” in Next.js
If you’re building web apps in Next.js, you’ve probably had to iterate through an array at some point. This means you’ll have run into the issue of keys; unique ids for each element. In this article, we’ll talk about keys, when to use them, [...]
A Developer’s Guide to Using useEffect in Next.js
If you’re familiar with React, then you’ve probably heard of the useEffect hook. It’s one of the most powerful and commonly used hooks in React, and it allows you to perform side effects in your components, such as fetching data from an API or setting up event listeners. In Next.js, [...]
How to Build an Efficient Pagination System with Next.js
Have you ever visited a website with a long list of items, only to feel overwhelmed and lost in the sea of information? That’s where pagination comes in handy. By dividing content into smaller, manageable chunks, pagination helps users navigate through a website more easily and efficiently. In this article, [...]
Why Next.js Is the Top Choice for Modern Web Development
Are you looking for a powerful and flexible framework to build your next web project? If so, you may want to consider Next.js. This React-based framework has gained popularity in recent years thanks to its many advantages, such as server-side rendering, automatic code splitting, [...]
Streamlining Serverless Web Development with Amplify and Next.js
AWS Amplify is a cloud development platform that streamlines the deployment of web applications, making it easier for developers to focus on writing code. With AWS Amplify, you can quickly deploy your Next.js app to the cloud and take advantage of its powerful features. In this article, I’ll guide you [...]
Mastering Next.js: How to Load Data from Files in Your Projects
If you’re a developer working with Next.js, you may have found yourself needing to load data from a file in your application. This could be anything from a JSON file containing configuration settings to a CSV file with data that needs to be processed and displayed on your site. Loading [...]
Email Made Easy: A Step-by-Step Guide to Sending Emails from Next.js
Sending emails is an essential part of many application. In this article, we’ll work through a full-stack solution for sending emails in Next.js, using Next.js API routes, along with SendGrid, a great API service for sending emails. Setting Up To use SendGrid, you’ll need to create an account. Head over [...]
From A to B: Mastering Data Transfer Between Components in NextJS
Next.js is a popular React-based framework that enables server-side rendering, automatic code splitting, and simpler client-side routing. In this article, we’ll discuss how to send data from one component to another in Next.js. There are a few approaches you might take to passing data between components. In this article we’ll [...]
How To Clean Up Your Next.js Code With Prettier
Prettier is a popular code formatter that can help keep your codebase organized and consistent. In this article, we’ll walk through how to set up Prettier in a Next.js project. Set-up Firstly of course you’ll need to install Prettier. You can do this with the following command: npm install --save-dev [...]
How To Build Next-Level Next.js Forms With Form Validation
Are you tired of dealing with tedious form validation in your React applications? Look no further than React Hook Forms in Next.js! RHF is a React hook that provides a simple and intuitive API for managing form state, validation, and submission. It supports both controlled and [...]
How To Level Up Your Next.js App with Scroll Animations
Animating components on scroll is a great way to add a touch of interactivity to your web application. It can help you create engaging user experiences that make your application stand out. In this article, we will explore how to use Framer Motion to [...]
Streamline Your Next.js Apps With the Context API
What is the Context API? The Context API lets developers pass data down the component tree without having to use props. It is a way to share data across multiple components without having to pass props through each level of the component hierarchy, i.e. to avoid “Prop Drilling” The Context [...]
How To Secure Your Next.js Apps With Auth0
Next.js is a popular open-source framework used for building web applications with React. One crucial aspect of web applications is authentication and authorization, which can be a complicated process to implement. This is where Auth0 steps in. Auth0 is a cloud-based identity platform that simplifies the process of adding authentication [...]
How to Enhance Your Next.js App with a Dynamic Navigation Bar
Hey there! If you’re a web developer, you know that navigation bars are a crucial part of any website. In this article, I’ll show how you how to build a nav bar in Next.js, from setting up your project to creating components styling with [...]
Effortlessly Manage Data in Next.js with React Query
React Query is a popular library for fetching, caching and managing the state of your data in React applications. Next.js is a great framework for building server-rendered or statically exported React applications. Together, they can make building fast and efficient data-driven applications even easier. We also have an article covering [...]
How To Set Up TailwindCSS in Your Next.js App
TailwindCSS is a popular utility-first CSS framework that allows developers to quickly and easily build responsive, consistent user interfaces. Next.js is a popular React-based framework, which works perfectly with Tailwind. If you’re using vanilla React, we also have an article covering using Tailwind with that [...]
Fetching Data From an API in Next.js
How to Set Up Chakra UI With Next.js
Chakra UI is a popular library for building user interfaces with a focus on accessibility and developer experience. It provides a set of reusable components that can be easily integrated into any project. In this article, we will go over the process of setting up Chakra UI with [...]
How To Build an Animated Dashboard with Framer Motion in Next.js
Framer Motion is a powerful animation library that makes it easy to create smooth, complex animations in your Next.js projects. In this article, we will explore the benefits of using Framer Motion in a Next.js project. By combining the two, you can create highly [...]
How To Use useState in Next.js
Functional components in Next.js are executed exactly like regular functions; they return some custom HTML used to render your component. This means any values in the function are initialised when you call the function, resetting them every time your component renders. You can use the useState hook to persist values [...]
How To Upload a File to S3 With Next.js
How To Create a Scroll to Top Button in Next.js
Scrolling to the top of a page can be a useful feature to include in your Next.js website or application. It can be especially helpful when a user has scrolled down a long page and wants to quickly return to the top. In this article, we’ll explore how to implement [...]
How To Add Google Fonts to Your Next.js App
Google Fonts is a great collection of free fonts to use in your web app. Thanks to Next.js, using any font from Google fonts is very streamlined and simple. In this article, I’ll talk you through the Next.js method, as well as a method that works for older versions of [...]
How To Use Environment Variables in Your Next.js App
Environment variables are variables passed to your app when it starts. They’re called so because they’re part of the environment your app will run in. They’re useful for things like telling your application if it’s running in production or development mode, or passing in values like API tokens or API [...]
Automating Your Next.js App with PM2
How To Use getStaticProps in Next.js
Next.js provides multiple methods of pre-rendering your content for your app. You can check out a comparison of these different methods here, but today I’ll be covering Static Site Generation with getStaticProps(). Static Site Generation pre-renders your content at build time, so that [...]
How to Create a To-do App with Strapi and Next.js
Strapi is a headless CMS, or Content Management System. If you’ve ever used a site editor like WordPress or Squarespace, these give you a back-end CMS, where you edit the content, and the front-end “head”, which handles displaying/rendering your content. With a headless CMS like Strapi, you can manage [...]
Creating an MDX Blog With Next.js
Markdown is a simple syntax for formatting text files. If you’re used to GitHub, you’re probably familiar with creating and editing readme.md files in your repos. MDX is an extension of markdown that adds support for JSX. Using Next.js’ Static Site generation, we can create a very simple to use, [...]
Deploying your Next.js App Through GitHub Pages
GitHub Pages is a great free resource for hosting unlimited static sites. You can build your Next.js app into a static site using Next’s export feature. There are a few features of Next.js you won’t be able to use with this, but in this article, I’ll talk you through deploying [...]
How To Use LocalStorage in Next.js
LocalStorage is an API that lets your site store things in the browser, to persist things when you leave the site. If you’ve ever wondered how browsers do things like save your settings and preferences, there’s a good chance they’re using LocalStorage. Checking the website for the game Wordle, for [...]
New Features in Next.js 13
A new version of Next.js has been released, featuring some great improvements for performance and usability, as well as some interesting new features, which I’ll talk you through in this article. Important features in Next.js 13 are New app/ DirectoryTurbopack – A new module bundler to speed up your appsnext/image [...]
How to Style Images in Next.js
Next.js provides a built-in Image component, which provides benefits like lazy loading, and improved performance. You get all these benefits for free just from using the Image component to display your images, but one issue with the component is its slightly convoluted approach to styling. Next.js has a lot [...]
How to Use File-Based Routing in Next.js
Next.js uses file-based routing. This means it looks in your pages directory and uses the path of any page components it finds to decide what the route for that page should be. Next.js has a few different ways of figuring out what the route for your page should be, so [...]
Global State Management With Next.js
There are a lot of solutions to global state management in Next.js, but one of the simplest methods is through the built-in useContext and useReducer hooks. You can use useReducer to manage your complex state, and the Context API to provide access to that state globally. Global State vs Props [...]
How to Convert Your Next.js App to TypeScript
Server Side Rendering with getServerSideProps in Next.js
Server Side Rendering attempts to convert as much of your webpage as possible to static HTML before serving the site. This means things like making an API call, instead of happening on the client when you navigate to the page, it will happen on the server, before the page is [...]
React vs Next.js. Which One Should You Use?
How to Fix “window is not defined” in Next.js
This issue has to do with Server-Side Rendering in Next.js. Next.js will by default try to use SSR for your site. This means that since we’re on the server and not in the browser, the “window” object does not exist. The workaround for this is forcing Next.js to run your [...]
How to Create Redirects in Next.js
Next.js provides out-of-the-box routing features which make redirecting straightforward and easy. In this tutorial, I’ll talk you through how to redirect through two different methods, permanent redirects through the Next.js config, and client-side redirects with the useRouter hook. If you’re not familiar with Next.js, it’s a great framework that expands [...]
getServerSideProps vs getInitialProps getStaticProps in Next.js
These three functions combine two topics, component props, and pre-rendering. Props can be used to pass values to a component, and you can find out more about that here. Since in Next.js pages are also components, we can pass values to them as well! The three “getXProps” functions each [...]
How To Parse Query String Parameters in Next.js
What Is a Query String? Example URL A query string is a method of passing variables to a URL, in the form of a list of key-value pairs, beginning with “?”, and separating each following “key=value” pair with an “&”. In the URL above we can see we have the [...]
How To Deploy Your NextJS App Through Vercel
Publishing your Next.js app can sometimes be a pain. One of the key benefits of using the Next.JS framework to create your website is how straightforward it can make deployment, abstracting away the usual difficulties, and providing a free, easy to use hosting solution through Vercel. What is Vercel? This [...]
What Is NextJS?
It's a new framework that builds on top of React and solves some of the problems that were not addressed in its precursor.
How To Use Environment Variables in NextJS Applications?
Environment variables are very useful when it comes to building modern web applications.
How To Link to an External Page in NextJS?
It's actually quite simple to do that, but you may be a little bit confused with the built-in Link components.
Where To Keep Components in a NextJS Application?
The structure of the files in your NextJS application is really important. I mean it literally.
Where To Use CSS in NextJS Projects?
Using CSS in NextJS applications is actually not as difficult as it may seem in the first place.
How To Use Material UI in NextJS Applications?
Material UI (MUI) is fantastic out of the box component library that developers can import into their projects and use.
How To Start a New NextJS Project and Open It in VS Code?
We can take advantage of Create Next App, which works very closely to how Create React App does for React.
How To Check My NextJS Version and Update It?
ersioning can be a nightmare to deal with, especially for new software engineers.
How To Use Images in NextJS Applications?
Images are a common part of many websites. It's important that you learn how to use the images properly in NextJS to make use of all of the optimizations that the framework developers have provided for us.