NEXT.JS

when building an app using react, the following has to be taken into consideration

Next.js: The React Framework

Next.js aims to have best-in-class developer experience and many built-in features, such as:

An intuitive page-based routing system (with support for dynamic routes) Pre-rendering, both static generation (SSG) and server-side rendering (SSR) are supported on a per-page basis Automatic code splitting for faster page loads Client-side routing with optimized prefetching Built-in CSS and Sass support, and support for any CSS-in-JS library Development environment with Fast Refresh support API routes to build API endpoints with Serverless Functions Fully extendable

Commands

Create a Next.js app

npx create-next-app nextjs-blog –use-npm –example “https://github.com/vercel/next-learn-starter/tree/master/learn-starter”

Run the development server

cd nextjs-blog npm run dev

Editing the starter Page

Download Starter Code (Optional)

npx create-next-app nextjs-blog –use-npm –example “https://github.com/vercel/next-learn-starter/tree/master/navigate-between-pages-starter”

Image Component

import Image from ‘next/image’

const YourComponent = () => ( <Image src=”/images/profile.jpg” // Route of the image file height={144} // Desired size with correct aspect ratio width={144} // Desired size with correct aspect ratio alt=”Your Name” /> )

Writing and Importing CSS

Restart the Development Server

npm run dev