Next Js Basics
1 min readMay 21, 2021
What is next Js
- The Next.js is React Based framework with server side rendering capability. It is very fast and SEO friendly.
- Using Next.js, you can create robust react based application quite easily and test them.
- Offers us both Server side Rendering & Static Site Generation.
Environment Setup
- Next js is react based framework, we are using Node environment. make sure you have Node.js and npm installed on your system.
- You can use the following command to install
npm install next react react-dom
- Once installed successfully you can observe the following output in terminal
react@16.13.1
react-dom@16.13.1
next@9.4.4
- Now, lets create a node package.json
npm init
- after that Create pages directory and Create a pages folder within nextjs folder and create an index.js file with following contents
function HomePage() {
return <div>Welcome to Next.js & Happy hacking !</div>
}
export default HomePage
- Runt the following command to start the server
npm run dev
Next Js Features
- Pages
- Static File Serving
- Meta Data
- CSS Support
- Global CSS Support
- Pre Rendering