-
Next.js is an open-source React front-end development web framework created by Vercel (formerly Zeit) that enables functionality such as server-side rendering and generating static websites for React based web applications.
-
Unlike a traditional React app where the entire application is loaded and rendered on the client, Next.js allows the first page to be rendered by the server, which is a great for SEO & perfromance.
- Easy page routing (No need of react router dom)
- API Routes
- Out of the box Typescript& Sass
- Static site generation (next export)
- Easy deployment
Getting Started - https://nextjs.org/docs/getting-started
npx create-next-app next-example --use-npm
oryarn create-next-app next-example
- cd next-example
- npm run dev
- Anything we put under page's directory will open in a separate route, ex. http://localhost:3000/about
- lowercase used for pages and Upper case used for components
- We cannot import globals css in any components, we have to import it in _app.js only
- Each page should have separate css file with your_css_name.module.css naming convention
- Any file inside the folder pages/api is mapped to /api/* and will be treated as an API endpoint instead of a page.