Next.js

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
How to Convert Your Next.js App to TypeScript

If you’re unsure of what TypeScript is, it’s basically a typed language built on top of JavaScript. All JavaScript is valid TypeScript, but not vice-versa. You can read more about it, and how it works with React/Next.js here. You can easily set up TypeScript [...]

By Omari Thompson-Edwards
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 [...]

By Vlad Mihet
React vs Next.js. Which One Should You Use?

With the recent trends in Front-End Web Development, we’ve seen a lot of additions to the collection of JavaScript frameworks, each being unique in its way and coming with its perks and disadvantages. As such, I wanted to look at the React side of things only, check the two main [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Omari Thompson-Edwards
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 [...]

By Dawid Budaszewski
Where Does Nextjs Put Build Folder?

The build is the process which creates (or builds) the optimized production version of your application that is ready for deployment.

By Dawid Budaszewski
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.

By Dawid Budaszewski
How To Use Environment Variables in NextJS Applications?

Environment variables are very useful when it comes to building modern web applications.

By Dawid Budaszewski
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.

By Dawid Budaszewski
Where To Keep Components in a NextJS Application?

The structure of the files in your NextJS application is really important. I mean it literally.

By Dawid Budaszewski
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.

By Dawid Budaszewski
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.

By Dawid Budaszewski
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.

By Dawid Budaszewski
How To Check My NextJS Version and Update It?

ersioning can be a nightmare to deal with, especially for new software engineers.

By Dawid Budaszewski
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.