Are wondering who is going to be the next PHP of the internet; except JavaScript. Next.js is all set to bring the PHP experience to JavaScript with its latest version. As the technology continues to be considered as a “win” amongst a number of developers across the globe, professionals are trying to improve it as much as they can. Because of its minimalist approach to server-rendered apps, this highly customizable framework can be recommendable for beginners as well as experienced professionals. The newest version, Next.js 3 has, even more, fun goodies to play around with. Dig in!
Now we all know that JavaScript isn’t easy to deploy on the first go. However, there are certain projects that aim to simplify the experience whereas some are more difficult than others. It may quite interest you to know that with over 17,000 stars on GitHub, Next.js has improved wildly since its initial offering last year. And now, Next.js 3 is available. Let’s take a closer look at this minimalist framework.
Next.js 3
Like I said before, the newest version has, even more, fun goodies to play around with. For example, the dynamic import allows for a codebase that can be split up into several sections that can be dynamically loaded on the later basis. In addition to this, the community-driven static export feature enables users to create a truly static site with no need for a server to deploy it.
Another important aspect is that the core bundle size for Next.js has decreased. And this is always good for your battery life. Other big changes include improved hot module replacement and an opt-in utility that makes it easier to dynamically load Reactive components.
Why love Zeit's Next.js?
In the following post, I'm going to cut right to the chase and shed light on a few of the amazing things that Next.js makes possible.
Ease in terms of use- If you have ever made use of the technology then you must be knowing how easy is to get started. One can have an app running as quick as their computer can install the required packages... seriously.
All you need to do is to create the shell for an app.
npm init -y # creates package.json npm install react react-dom next # installs necessary dependencies mkdir pages && touch pages/index.js
After knowing that your package.json’s script's object has been modified correctly, you can paste the code below into the pages/index.js, run npm run dev and watch your application come to life.
import React from 'react'; export default ({title = 'How tight is this next.js thing?'}) => <h2>{title}</h2>;
The <code>pages</code> simply acts as our router in the technology. For example, if one adds the same code to a new file named pages/about.js and then visited localhost:3000/about, then you will see how the component is displayed as per estimated.
Apart from this, there are several other benefits of using Next.JS such as automatic code spitting, prefetching, server-side rendering, HMR and error reporting and the list goes on. Keep watching the space to get a better idea regarding the same.