Create React App vs Next.js: A Quick Comparison
Tags: react, nextjs
Published: 2021-02-02 16:49:17

<!-- wp:paragraph -->
<p>Building any application is a challenge itself, but modern technologies can make the development process a bit less painful. Thanks to them, you can focus on your business objectives.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To make your choice of these technologies easier, once in a while we take a closer look at them in our blog posts. Our goal is to help you make a good decision on what to use in what case.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>This time, let’s take a look at <a href="https://reactjs.org/docs/create-a-new-react-app.html" target="_blank" rel="noreferrer noopener nofollow">Create React App</a> (CRA) vs <a href="https://nextjs.org/" target="_blank" rel="noreferrer noopener nofollow">Next.js</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><br><br>Create React App (CRA)</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you are just starting out with React, Create React App is a great way to learn it. CRA will also give you a head start if you want to use <a href="https://pagepro.co/react-development.html" target="_blank" rel="noreferrer noopener">React</a> to build a single-page application (SPA).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Thanks to the development environment created by Create React App:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>You can use the latest JavaScript features</li><li>You will have a great DX (developer experience)</li><li>Your app is optimized for production usage</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You’ll need to have Node ≥ 8.10 and npm ≥ 5.6 on your machine.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Because Create React App is just responsible for creating a front-end build, you can use it with a back-end of your choice like <a href="https://pagepro.co/nodejs-development.html" target="_blank" rel="noreferrer noopener">Node</a>. You should also know that CRA uses Babel and Webpack under the hood but don’t worry, no knowledge of them is required.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In other words, <a href="https://reactjs.org/docs/create-a-new-react-app.html" target="_blank" rel="noreferrer noopener nofollow">C</a>RA is a tool that saves you from the time-consuming setup and configuration of the development environment. All you need to do is run one command which will set up tools needed for React project start. So instead of wasting time on configuration, you can focus on building an app right away.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you want to learn more about Create React App, check its <a href="https://github.com/facebook/create-react-app/blob/master/README.md" target="_blank" rel="noreferrer noopener nofollow">README</a> and the <a href="https://facebook.github.io/create-react-app/" target="_blank" rel="noreferrer noopener nofollow">User Guide</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>However, it won’t be enough to build performant production-ready apps. There are more things to take into consideration like SEO or increasing performance. For the first one, you might need server-side rendering, and for the latter code-splitting.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To achieve these goals, you can either use a boilerplate like <a href="https://www.reactmilkshake.com/" target="_blank" rel="noreferrer noopener nofollow">React Milkshake</a> or a framework based on React like <a href="https://nextjs.org/" target="_blank" rel="noreferrer noopener nofollow">Next.js</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Advantages of using Create-React-App</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>It gives you freedom.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>No more using a particular library just because you have to – Create React App gives you a possibility to choose whatever routing library you want. Also, if you want to use, let’s say, TypeScript, it's possible thanks to templates.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Support for rendering on the client-side.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Because of client-side rendering, deployment becomes easy because such apps are easier to work with. What’s great that you can use any hosting, i.e. Amazon S3.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Disadvantages of Create-React-App</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>It’s not easy to customise.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Customisation means additional effort because there is no built-in way to do that. If you are thinking about modifying the configuration of Webpack, you need a third-party tool like craco or eject. However, there is a cost of such a solution – at the moment of the ejection, you lose the future support.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>It’s limiting.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you want something out-of-the-box, something that CRA doesn’t support by default, well, it gets messy. Lack of necessity to configure Babel and Webpack is a reason that’s easy to get started, but on the other hand, developers don’t know how to use these tools. Therefore, it complicates customization.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>It doesn't support SEO</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Applications that are being rendered on the client-side – including those built with Create React App – are bad for SEO so it’s not a great solution for the e-commerce industry or marketing goals. However, it also depends strongly on the other tools of your choice.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><br><br>Next.js</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><strong>Next.js</strong> is an open-source framework based on Node.js and Babel built by Vercel. It uses the benefits of React to help developers build single-page applications. Contrary to Create React App, it supports server-side rendering.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Next.js features:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li><a href="https://pagepro.co/blog/ssrvscsr/" target="_blank" rel="noreferrer noopener">Server-Side Rendering</a> (SSR)</li><li>Static exporting (SSG)</li><li>Pre-rendering</li><li>Automatic build size optimization</li><li>Faster development compilation</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>All these features helps you with building a performand and production-ready app.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>There are two more worth-mentioning things – Next.js offers <a href="https://nextjs.org/docs" target="_blank" rel="noreferrer noopener nofollow">great documentation</a> and is gaining popularity within the programming world.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>However, even those things doesn’t make Next.js one-fits-all solution.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Sure, server-side rendering becomes much easier thanks to that but it also causes some troubles. Every server-rendered route needs a serverless function and because the free limit of such functions is 12, you may need to pay for hosting if this amount exceeds the number of 12.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>On the contrary, if you are using Create React App, you can be sure that you won’t pay for hosting on platforms like <a href="https://vercel.com/dashboard" target="_blank" rel="noreferrer noopener nofollow">Vercel</a>, <a href="https://netlify.com/" target="_blank" rel="noreferrer noopener nofollow">Netlify</a> or <a href="https://render.com/" target="_blank" rel="noreferrer noopener nofollow">Render</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Advantages of using Next.js</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>It is blazingly fast.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Applications created with Next.js are blazingly fast because of static-site generation and server-side rendering. They are performant by default because of many performance-optimising features like Image Optimisation introduced together with Next 10.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Deployment is easy.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>One of the goals of Vercel, a company that created Next.js, was to make deployment of React applications as easy as possible. And they achieved it – you are just a few clicks away from getting deployment ready.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Possibility to use API Routes.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you want to connect your application with third-party APIs, usually you will need your own API and Next.js makes it easy to create. In short, Next.js offers API routes that will do the job.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Customisation is easy.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>While customisation is hard with CRA, Next.js makes it easier by giving possibility to add Webpack loaders or Babel plugins.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Disadvantages of using Next.js</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>It’s opinionated.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Since Next.js is limited to using only its file-based router, you can’t modify the way it deals with routes. Going further, you need Node.js server to use dynamic routes.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3><br><br>When to use Next.js?</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>To build a landing page.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Next.js is loved by marketers who gladly use it to create landing pages or other marketing-focused pages.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>When SEO matters.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you want to build or currently have an online store, you must be aware that SEO matters and can give you a competitive advantage. And thanks to its speed, server-side rendering and special features, Next.js is the first choice for many when it comes to getting more organic traffic.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>To build marketing websites.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Because our application will be rendered on the server, load times can improve significantly. Especially in those cases where visitors use slower devices.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>To build a eCommerce webshop.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>A few weeks ago Next JS, released a mighty <a href="https://nextjs.org/commerce" target="_blank" rel="noreferrer noopener nofollow">eCommerce starter kit</a> that allows you to build high-performance, user and Google-friendly webshops. </p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>When to use Create-React-App?</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>To build a gated application.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Think about your future application. If it will be available only for those who are authenticated, server-side rendering is not that necessary. Apps that are using client-side rendering will be not only easier to host but also cheaper.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>To build web applications.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you want to build an application, it will be used mainly by returning visitors. In such a case, server-side rendering isn’t a must because we can use caching to achieve good load times with less effort.</p>
<!-- /wp:paragraph -->