Next.js — The React Framework for Production(Intro)

Search for a command to run...

No comments yet. Be the first to comment.
Bun, the hyper-fast JavaScript runtime known for its incredible speed and Zig-based architecture, is being completely rewritten in Rust. For a project that has over 22 million monthly downloads and ea

Next.js 16.3 is almost here, and it's packed with a ton of improvements and let's see them in this post 1.Instant Navigation For a while now, there’s been a valid, lingering debateServer Components vs

It’s official. React has merged its long-awaited Rust port of the React Compiler (formerly known as React Forget) into the main repository. What started as an experimental research project by Joseph S

If you follow modern technology trends, you have likely been led to believe that artificial intelligence is entirely built on Python. Every tutorial, machine learning framework documentation, and open

Just when the JavaScript ecosystem was catching its breath after last week’s TanStack Router compromise, the Mini Shai-Hulud supply chain worm has continued its relentless march. Developed by the thre

If you don’t have time to read but want to know what’s there in this post. Find the quick read 👇

Intro about Next.js
How Next.js is different from React
Settingup new Next.js application
Next.js is an opinionated React framework that enables several extra features, including server-side rendering, and generating static websites.
React is a JavaScript library that is traditionally used to build web applications rendered in the client’s browser with JavaScript.
The main idea behind the framework(Next.js) is to ensure applications start and remain as performant as possible by having these capabilities included by default.

Image represents the development history of Next.js

React is a library that makes it easier to build user interfaces using a component-based approach. Although powerful, React is specifically a UI library. Many developers include additional tooling such as a module bundler (webpack for example) and a transpiler (Babel for example) to have a complete build toolchain.
In the React collection, we took the approach of using Create React App (CRA) to spin up React apps quickly. CRA takes the hassle out of setting up a React application by providing a complete build toolchain with a single command.
Next.js, which can also be used to create a new React application, takes a different approach. It immediately provides a number of common optimizations that many developers would like to have but find difficult to set up, such as:
Server-side rendering
Automatic code-splitting
Route prefetching
File-system routing
CSS-in-JS styling ([styled-jsx](https://github.com/zeit/styled-jsx))

To create a new Next.js application, run the following command:
npx create-next-app new-app

Once the installation is done navigate to the directory and start the development server using the below command
cd new-app npm run dev
Notice that a pages/ directory is created with a single file: index.jsx. Next.js follows a file-system routing approach, where every page within this directory is served as a separate route. Creating a new file in this directory, such as about.js, will automatically create a new route (/about).
Components can also be created and used like any other React application. A components/ directory has already been created with a single component, nav.js, which is already imported in index.js. By default, every import used in Next.js is only fetched when that page is loaded, providing the benefits of automated code-splitting.

The preview of Next.js directory with the newly created files
Moreover, every initial page load in Next.js is server-side rendered. If you open the Network panel in DevTools, you can see the initial request for the document returns a fully server-rendered page.

The Preview tab of the Network panel shows that Next.js returns visually complete HTML

Today we have seen about the introduction about Next.js frameworks and how it differs from ReactJS by creating a simple application.
Will Catch you up in a new post till then Happy Learning:)