By default React is a JavaScript library for building user interfaces
In React, for routing we have to use third party libraries for handling various features like for routing we might use react-router-dom.
We are still gonna write React code. NextJS just enhances your React app and adds more feature.
In production there are certain problems which we will need to solve for almost all production-ready React apps: NextJS solves those for us like SEO
-
Built-in Server-side Rendering
Building every single page in server. React alone is a Client Side Render which on demand manupulates the dom to create a new site according to url. In CSR initial loading is an issue. CSR also affects SEO. As Google crawlers might only see inital empty html with bundle.js which is bad for SEO but it might not be a proble for a login dashboard type of applications. TLDR: SSR means we get totally loaded html page from server. So there will be no any loading state for User experience as well as for SEO(google crawlers)
-
File-based Routing
- Define pages and routes with files and folders instead of code
- Less code, less work, highly understandable
-
Fullstack Capabilities
- Easily add backend (server-side) code to your Next/React apps
- Storing data, getting data, authentication etc, can be added to your React projects