Skip to content

Commit b396d6c

Browse files
committed
fixes
1 parent 57e6f6e commit b396d6c

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

docs/Nextjs/intro-nextjs.md

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
---
2-
id: intro-nextjs
3-
title: Introduction to Next.js
4-
sidebar_label: Introduction to Next.js
5-
sidebar_position: 1
6-
tags:
7-
- Next.js
8-
- Introduction to Next.js
9-
- What is Next.js
10-
- Why learn Next.js
11-
- How to use Next.js
12-
description: Learn about Next.js, the powerful React framework for building production-ready web applications. Discover its features, benefits, rendering strategies, and how to get started with your first project.
13-
---
14-
151
**Next.js** is a production-ready React framework that revolutionizes how we build modern web applications. Created and maintained by [Vercel](https://vercel.com), Next.js extends React's capabilities by providing a robust, opinionated structure that handles the complexities of production deployment, performance optimization, and developer experience out of the box.
162

173
## What Makes Next.js Special?
@@ -27,7 +13,7 @@ Unlike vanilla React applications that require extensive configuration and addit
2713
- 🛠️ **Full-Stack Capabilities** - Build APIs alongside your frontend using API Routes or Server Actions
2814
- 📦 **Production-Ready** - Optimized builds and seamless deployment with Vercel or any Node.js hosting
2915

30-
Next.js offers both <a href="https://nextjs.org/docs/getting-started">free</a> and commercial hosting solutions through Vercel, with features like automatic deployments, edge functions, real-time analytics, and global CDN distribution.
16+
Next.js offers both <a href="https://nextjs.org/docs">free</a> and commercial hosting solutions through Vercel, with features like automatic deployments, edge functions, real-time analytics, and global CDN distribution.
3117

3218
:::
3319

@@ -55,7 +41,6 @@ While alternatives like Gatsby (static sites), Remix (web standards focus), and
5541

5642
One of Next.js's most powerful features is its **flexible rendering approach**. Let's understand this with a real-world example:
5743

58-
:::info
5944
**E-commerce Application Example:**
6045

6146
Imagine you're building an online store. Different pages have different requirements:
@@ -80,11 +65,14 @@ Imagine you're building an online store. Different pages have different requirem
8065
- Leverages browser capabilities
8166

8267
Next.js empowers you to **mix and match** these strategies within the same application, choosing the optimal approach for each page. This flexibility is what makes Next.js stand out from other frameworks.
83-
:::
8468

69+
<!--
8570
<BrowserWindow url="https://nextjs.org/" bodyStyle={{padding: 0}}>
8671
[![Next.js Framework](./assets/nextjs-logo.png)](https://nextjs.org/)
87-
</BrowserWindow>
72+
</BrowserWindow> -->
73+
74+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 180 180" width="18"><mask height="180" id=":r8:mask0_408_134" maskUnits="userSpaceOnUse" width="180" x="0" y="0" style="mask-type: alpha;"><circle cx="90" cy="90" fill="black" r="90"></circle></mask><g mask="url(#:r8:mask0_408_134)"><circle cx="90" cy="90" data-circle="true" fill="black" r="90"></circle><path d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z" fill="url(#:r8:paint0_linear_408_134)"></path><rect fill="url(#:r8:paint1_linear_408_134)" height="72" width="12" x="115" y="54"></rect></g><defs><linearGradient gradientUnits="userSpaceOnUse" id=":r8:paint0_linear_408_134" x1="109" x2="144.5" y1="116.5" y2="160.5"><stop stop-color="white"></stop><stop offset="1" stop-color="white" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id=":r8:paint1_linear_408_134" x1="121" x2="120.799" y1="54" y2="106.875"><stop stop-color="white"></stop><stop offset="1" stop-color="white" stop-opacity="0"></stop></linearGradient></defs>
75+
</svg>
8876

8977
## Understanding React and React Frameworks
9078

@@ -102,7 +90,6 @@ However, React alone doesn't provide:
10290

10391
This is where **React frameworks** like Next.js come into play.
10492

105-
:::info
10693
**Understanding React Frameworks:**
10794

10895
Think of React as the **engine** of a car - powerful and essential, but not sufficient on its own. To build a complete, roadworthy vehicle, you need wheels, steering, transmission, suspension, and countless other components.
@@ -176,7 +163,6 @@ You can build **any type** of web application with Next.js:
176163

177164
Let's explore what makes Next.js a comprehensive framework:
178165

179-
:::info
180166
**Feature Categories:**
181167

182168
**1. Routing System**
@@ -214,8 +200,6 @@ Let's explore what makes Next.js a comprehensive framework:
214200

215201
Next.js **automates the hard parts** of web development, allowing you to focus on creating amazing user experiences rather than wrestling with configuration and optimization.
216202

217-
:::
218-
219203
## Getting Started: Your First Next.js Project
220204

221205
### Prerequisites
@@ -225,10 +209,14 @@ Before creating a Next.js application, ensure you have:
225209
- A code editor (VS Code recommended)
226210
- Basic knowledge of React, JavaScript/TypeScript, and HTML/CSS
227211

212+
**New to React?** Don't worry! While Next.js is built on React, you can learn both simultaneously. Start with basic React concepts like components, props, and state, then gradually explore Next.js features. The [React documentation](https://react.dev/learn) is an excellent resource to get started.
213+
228214
### Installation and Setup
229215

230216
Creating a new Next.js project is straightforward with the official `create-next-app` tool:
231217

218+
**What is npx?** It's a package runner tool that comes with npm (Node Package Manager). It allows you to run packages without installing them globally. Think of it as a way to execute commands directly from the npm registry.
219+
232220
```bash
233221
# Create a new Next.js app with the latest version
234222
npx create-next-app@latest my-next-app
@@ -250,14 +238,14 @@ npm run dev
250238

251239
Your Next.js application will be running at `http://localhost:3000` with hot reloading enabled.
252240

253-
:::tip
241+
**What is localhost:3000?** This is your local development server. `localhost` refers to your own computer, and `3000` is the port number. Open your web browser and type this address to see your application. Hot reloading means changes you make to your code will automatically appear in the browser without manual refresh!
242+
254243
**Quick Start Recommendations:**
255244
- ✅ Use **TypeScript** for better type safety and developer experience
256245
- ✅ Use **ESLint** to catch errors early
257246
- ✅ Use **Tailwind CSS** for rapid UI development
258247
- ✅ Use **App Router** (Next.js 13+) for the latest features
259248
- ✅ Enable **`src/` directory** for cleaner project organization
260-
:::
261249

262250
### Understanding the Project Structure
263251

@@ -285,10 +273,12 @@ my-next-app/
285273
- `layout.tsx`: Shared UI between routes (navbar, footer)
286274
- `page.tsx`: Unique page content
287275
- Add folders to create nested routes
276+
- **Beginner Tip**: Think of `layout.tsx` as a wrapper that appears on multiple pages (like a template), while `page.tsx` is the unique content for each page
288277

289278
- **`public/`**: Store static files like images, fonts, or robots.txt
290279
- Files are served from the root URL
291280
- Example: `public/logo.png``yoursite.com/logo.png`
281+
- **Beginner Tip**: Drop any image here and you can access it directly in your code like `<img src="/logo.png" />` - no import needed!
292282

293283
- **`next.config.js`**: Configure Next.js behavior
294284
- Add redirects, rewrites, environment variables
@@ -297,12 +287,14 @@ my-next-app/
297287
### Essential npm Scripts
298288

299289
```bash
300-
npm run dev # Start development server (port 3000)
301-
npm run build # Create optimized production build
302-
npm run start # Start production server
303-
npm run lint # Run ESLint to check code quality
290+
npm run dev # Start development server (port 3000) - Use this while coding
291+
npm run build # Create optimized production build - Run before deploying
292+
npm run start # Start production server - Test your production build locally
293+
npm run lint # Run ESLint to check code quality - Find code issues
304294
```
305295

296+
**For Beginners**: During development, you'll mainly use `npm run dev`. This starts a local server with helpful error messages and hot reloading. Only use `npm run build` and `npm run start` when you want to test how your app will perform in production or before deploying.
297+
306298
## Learning Path & Next Steps
307299

308300
Now that you understand what Next.js is and why it's valuable, here's your learning roadmap:
@@ -367,7 +359,5 @@ Whether you're a beginner learning web development or an experienced developer l
367359

368360
In the next tutorial, we'll dive deeper into creating your first Next.js application, exploring the file-based routing system, and building your first pages. Get ready to experience the power and simplicity of Next.js!
369361

370-
:::tip
371362
**Ready to Start Building?**
372363
Run `npx create-next-app@latest` right now and follow along with the upcoming tutorials. The best way to learn is by doing! 🚀
373-
:::

0 commit comments

Comments
 (0)