We're hiring! Check out open positions
Development

Next.js vs React: Which is the Best Frontend Technology for your Upcoming Project?

Tim Davidson
11 min read

React is the incumbent technology of modern frontend development for startups. It’s become synonymous with creating beautiful, interactive user interfaces, to the point where non-technical entrepreneurs don’t understand that sometimes there are better-fitting technologies for their project, like Next.js.

Hold on there! Isn’t Next.js and React essentially the same thing? If they’re different, what are the benefits of one over the other? And what kind of projects would suit one and not the other?

Good questions. This is what we’ll be unpacking. Feel free to skip ahead if you’re looking for a particular answer.

  1. React explained

    1. What is react and why use it?
    2. React features
    3. Pros of React
    4. Cons of React
    5. Examples of apps built with React
  2. Next.js explained

    1. What is next.js and why use it?
    2. Next features
    3. Pros of Next
    4. Cons of Next
    5. Examples of apps built with Next.js
  3. FAQ

React explained

What is React and why use it?

React is an open-source JavaScript user interface library built by the Facebook team in 2013. It’s become wildly popular for building web and mobile applications and has laid the foundations for many excellent frameworks such as React Native and Next.js.

React saves developers time in building new products. Writing a mobile app or complex web app in raw JavaScript is completely possible, but it’s hugely inefficient since there’s a lot of recreating the wheel.

Rather than rebuilding functions that every application needs, React offers a nicely organised library of code. However, it’s still just a library rather than a framework that offers opinions on how to build an application.

1oih3

React has countless use cases and the breadth of applications that it’s been used to build is mind-boggling. We’ll list some actual examples a little later, but here are a handful of good use cases for React:

  • Building single page applications (SPAs)
  • Building the frontend of a new Social Media platform
  • Developing a news site or similar application that is content-oriented and needs to be heavily interactive
  • Creating a simple RSS feed reader
  • Developing complex data visualisation dashboards

React Features

React has a ton of great features which have laid the foundation for frameworks like Next, React Native and Create React App. Here are the features worth paying attention to:

React Router

Super useful in developing Single Page Applications. Since SPAs don’t have “pages” like traditional monolithic websites like WordPress, they need a system for routing between different views. That’s where React Router does its work.  

One Way Data Binding

When developing React applications, data is always sent to the child node from the parent as read-only properties. This is a feature only developers can truly appreciate, but having a unidirectional data flow between components is much easier to understand. When multiple developers are working together on a larger project, anything that helps simplify complex code is a benefit.

Virtual DOM

The Document Object Model (DOM) is essentially the name given to the page you see in a browser. It represents all the styles, structures and content that make up everything on your screen when you’re viewing a website or web app. The problem with a traditional DOM is that modifying it is slower than most JavaScript operations.  

As a solution, React provides a virtual DOM. Every DOM object has a corresponding copy in the virtual DOM. Whenever React makes a change, it happens in the virtual DOM first before being reflected on the actual DOM.

229jd

The best way of thinking about this is drafting changes on a blueprint rather than rebuilding sections of a house.

JSX (JavaScript Syntax Extension)

JSX is a JavaScript Syntax Extension that allows HTML and JavaScript to be written together. This is a benefit because while the rendering of JavaScript logic is separate from the user interface, they’re tightly coupled together. Writing JS and HTML in the same function can make the UI easier to visualise.

React Hooks

React Hooks are a fairly complex concept to expand on if you’re not familiar with JavaScript functions and the difference between stateless and stateful components. Without explaining exactly what hooks are, React comes baked with a bunch of standard in-built hooks that help with component state management.

Pros of using React

Active Community: React has 195k+ stars on Github, thousands of regular users, and a big talent pool contributing to its promotion and growth. This is good news for any business looking to pick a permanent technology for their new product.

High Reusability: React components are intended to be reusable. Being able to easily reuse components rather than spending the time building something from scratch is a huge time and money saver. It also makes the project more easily maintainable.

3p3qjf

Good Documentation: Good documentation is a must-have for any complex technology, and React docs adhere to this principle. Besides this, community resources like these Youtube videos or stack overflow questions help to learn React and its core aspects without extra effort.

42qdmqio

Customisation: Unlike frameworks that dictate particular approaches to building interfaces, React is simply a library. It can be combined with other technologies and implemented pretty much any way that suits the project. This allows it an unrivalled level of flexibility and customisation.

Cons of using React

Tons of underqualified devs: React is the first step for most new JavaScript developers, once they’ve got a handle on the basics. It’s relatively easy for new developers to pick up and build basic apps to throw on a CV. As a result, every man and his dog claims to be a React developer.

Building an organised, maintainable and scale-able application using any framework is difficult and requires more knowledge than just writing basic React functions. As a startup or even an established business looking to hire React developers, you can’t trust that any old React dev will know what they’re doing.

Lack of conventions: The development team is responsible for determining the development stack, since React is just the view library. This can be a problem for teams or freelancers that don’t have a strong grip on the best technology to pick for each job.

More complex: React is intended to handle complex use cases. Sometimes it’s overkill for simple applications that would do better with something like Alpine.js or even vanilla JS.

Examples of apps built with React

React apps are everywhere. Plenty of the big online services you’re used to using on a daily basis have been built with React. To give you a bit of context, here are a handful of popular applications.

  • AirBnB
  • Trello
  • Instagram
  • Facebook
  • Netflix
  • New York Times
  • Asana
  • Cloudflare
  • BBC
  • Imgur
  • PayPal

52qd992

Next.js explained

What is Next.js and why use it?

Now that we’ve covered the high-level details about React, it’s time to introduce its most popular frontend framework, Next.js.

Next.js is a React-based JavaScript framework, created by Vercel in 2016. Their primary goal is to provide a developer-friendly stack of tools for creating React-based applications.

Next does a bunch of cool things but its big claim to fame is the rendering flexibility it provides. Since it’s coupled together with Node.js, it can render content on the server as well as statically at build time. All this means is websites or apps built with Next can be configured for elite performance without the usual headaches that come with static site generation.

If you browse around the websites of big tech brands, you’ll find Next.js everywhere. If you don’t know how to see what technology a website is running on, I’ve written a handy guide on the topic. Brands such as Github, Twitch, Hulu, Nike and Nintendo have all thrown their chips behind Next as their frontend framework of choice. It’s quick, secure and easy to work with.

Since Next.js is a framework for React, all the regular React syntax and features are available, in addition to a bunch of extensions.

Next.js features

Next comes with some seriously cool features. Here are the top picks.

Data Fetching

Utilising the two pre-fetching approaches (static generation and server-side rendering), the Next-based projects can be easily optimised for fast loading. While pre-fetching enables the Static site creation for SEO and fast content delivery on user request, its Hot Code Reload feature can dynamically load the newly-updated data on a web page.

Code Splitting

Next’s code splitting is a neat feature that bundles up just the necessary chunk of the Next.js application that is required for a user to view a single page. Since the user only has to download this small package of code to start interacting with the webpage, they can do so incredibly quickly, unlocking elite load times and performance.

6x29dj

Typescript Support

Next.js supports TypeScript out of the box. TypeScript is a JavaScript extension developed by Microsoft to solve some of the complexity in how JS handles different data types. From a business perspective, using TypeScript in a Next.js application is going to cut down on errors and the amount of time that goes into bug fixing.

The Edge

Depending on which host you’re using, Next.js can be deployed to “The Edge”. This concept is essentially a network of servers that host the Next.js application in a similar way to a content distribution network. Whichever server is geographically closest to the user will serve the content.

On a traditional Content Distribution Network, this is limited to static content like images and HTML. However, Edge servers can run some backend functions too. So caching and code execution can be done physically closer to the user, resulting in even faster websites and applications.

7jwne

Pros of using Next.js

It’s Performant: As a frontend framework that supports static site generation (SSG), Next.js creates super fast-loading websites and applications. It also comes packed with an innovative feature called SWV (stale-while-validated) that returns data from the cache to load the page immediately and then works on loading updated data.

Image Optimization: Next natively puts images through a variety of optimizations intended to help in passing Google’s Core Web Vitals assessment.

  1. Serving images at the correct size for different devices, using modern formats like webP
  2. Preventing cumulative layout shift
  3. Lazy load by default and the image area is blurred until fully loaded
  4. On-demand image resizing

Built-in CSS: Next.js lets you import CSS styles from a JS file. This is a nice feature for keeping larger Next applications organised.

Cons of using Next.js

Honestly, Next is such a great framework that’s been well thought out by the Vercel team. It stands up compared to its main React competitor, Create-react-app. The only major downside is:

Server-side rendering is complex: Honestly, this isn’t even a huge downside. But SSR isn’t straightforward. For a frontend developer, it requires knowledge of Node.js and some knowledge that may not be in their skillset.

Examples of Next.js projects

Considering the efficiency of Next.js, the Hulu web development team chose it among all Javascript Frameworks. They used Next to create their entire app for web users.

Netflix, the top streaming platform, uses Next JS as it ensures smooth navigation and fast content rendering, delivering the best user experience through the UI.

Next is a great framework for eCommerce development as well as for selling digital goods. That’s the reason why AT&T Store uses this React Framework.

Frequently Asked Questions

Are React and Next.js The Same?

They’re not the same. React is a Javascript library for building UI’s. Next.js is a framework for building applications. While it’s built on top of React, it’s a more complete solution that provides all the tools and an opinionated approach to building an application.

Is Next.js better than React?

Neither technology is “better” than the other. There are cases when implementing a full frontend framework like Next.js makes sense, and others when using React in combination with another stack is the best approach.

Since Next.js is an extension of React, it comes with additional features out of the box that React doesn’t, like static site rendering and conditional server-side rendering.

Is Next.js or React better for SEO?

Next.js is better suited to building websites, especially if good SEO is the goal. There’s a lot more to SEO than just the technology used to build a website, but Google has started focusing heavily on websites that load quickly and pass the CWV assessment, which is one of Next’s specialities, given it supports static site generation and code-splitting.

Have any other questions that we haven’t answered here? Leave them below in the comments section, and we’ll get back to you in a day or so!

Tim Davidson
Tim Davidson
Tim is the face of the company. When you want to kick off a new project, or an update on your existing project, Tim is your man. With a background in project management, Tim specialises in managing the chaos around the company.

Have an idea you want to discuss?

We’re based in Canberra, Australia and we LOVE working with locals… but we work with clients all around the world.

From the U.S. to the U.K. From Norway to New Zealand. Where there’s a problem to solve, we’ll be there!

More insights from us

MACH architecture - The ultimate growth play
Development

MACH architecture - The ultimate growth play

MACH architecture has become a red-hot trend in the enterprise world for the past few years. It's an abbreviation of…
Tim Davidson
Tim Davidson
10 min read
Next.js vs Gatsby.js - Which Is The Best React Framework?
Development

Next.js vs Gatsby.js - Which Is The Best React Framework?

Next.js and Gatsby are two of the most popular static site generators used to build fast and SEO-friendly websites. They…
Tim Davidson
Tim Davidson
9 min read
The Pros and Cons of Headless Commerce - The Double Edged Sword
Development

The Pros and Cons of Headless Commerce - The Double Edged Sword

Our team recently jumped in to help a headless eCommerce project that was heading in the wrong direction. The team had…
Tim Davidson
Tim Davidson
11 min read