Ensiklopedia VibeKoding: An Introduction to Frontend Frameworks.Ensiklopedia VibeKoding: An Introduction to Frontend Frameworks.
You've learned the basics of HTML, CSS, and JavaScript and can now build simple web pages. But as web functionality grows more complex, you may notice that writing raw JavaScript becomes hard to maintain โ changing one thing requires touching many places, and collaboration often leads to conflicts. This is why we need frontend frameworks โ they make code more organized, easier to maintain, and more efficient to develop. In vibecoding, AI writes most of the code for you. But you should at least be able to read different frameworks' code styles, understand their pros and cons, so the AI can help you choose the most suitable tech stack. By the end of this article, you'll be able to: - Understand why frontend technology keeps evolving - Know the characteristics of Vue, React, Svelte, and Angular - Grasp core concepts like "data-driven" and "component-based" development - Choose the right framework for your projectYou've learned the basics of HTML, CSS, and JavaScript and can now build simple web pages. But as web functionality grows more complex, you may notice that writing raw JavaScript becomes hard to maintain โ changing one thing requires touching many places, and collaboration often leads to conflicts. This is why we need frontend frameworks โ they make code more organized, easier to maintain, and more efficient to develop. In vibecoding, AI writes most of the code for you. But you should at least be able to read different frameworks' code styles, understand their pros and cons, so the AI can help you choose the most suitable tech stack. By the end of this article, you'll be able to: - Understand why frontend technology keeps evolving - Know the characteristics of Vue, React, Svelte, and Angular - Grasp core concepts like "data-driven" and "component-based" development - Choose the right framework for your project
What will this article teach you?What will this article teach you?
| Chapter | Content | What You'll Gain |
|---|---|---|
| Chapter 1 | Why care about frontend evolution | Understand what problems each evolution solves |
| Chapter 2 | The static web page era | Learn the earliest web development approaches |
| Chapter 3 | The jQuery era | Understand the pain points of "imperative" programming |
| Chapter 4 | The Vue/React era | Master "declarative" and "data-driven" thinking |
| Chapter 5 | Rendering strategies | Know the differences and use cases of CSR, SSR, and SSG |
| Chapter 6 | Engineering tooling | Understand the role of build tools like Webpack and Vite |
Each chapter begins with "Why do we need this technology?" so you understand the logic behind each evolution.Each chapter begins with "Why do we need this technology?" so you understand the logic behind each evolution.
------
Why are web pages getting more complex? Why does frontend technology keep evolving? This question will guide you through the technological journey from simple web pages to modern web applications.Why are web pages getting more complex? Why does frontend technology keep evolving? This question will guide you through the technological journey from simple web pages to modern web applications.
Think about a poster you see on the street:Think about a poster you see on the street:
The earliest web pages were just like these "digital posters": view-only, unchangeable, with fixed content.The earliest web pages were just like these "digital posters": view-only, unchangeable, with fixed content.
Modern web pages are completely different. They're like desktop applications (VS Code, Figma):Modern web pages are completely different. They're like desktop applications (VS Code, Figma):
The core reason for this transformation: web page functionality has become increasingly complex, requiring more efficient technologies and development approaches.The core reason for this transformation: web page functionality has become increasingly complex, requiring more efficient technologies and development approaches.
The evolution of frontend technology is like the evolution of house construction:The evolution of frontend technology is like the evolution of house construction:
| Era | ๐ House Analogy | Actual Characteristics | Pros & Cons |
|---|---|---|---|
| 2000s | Putting up posters | Static web pages โ just write HTML | โ Simple โ No interactivity |
| 2010s | Hiring workers for manual renovation | jQuery era โ manually manipulate every element | โ Interactive โ Messy code, hard to maintain |
| 2020s | Building with LEGO blocks | Vue/React era โ component-based development | โ Efficient, maintainable โ Learning curve |
Phase 1 โ Phase 2: From "can't move" to "can move." This is a qualitative leap โ web pages become interactive, but at the cost of messy code. Phase 2 โ Phase 3: From "usable" to "delightful." Component-based development makes code reusable like building blocks, dramatically improving development efficiency. Core insight: Technological evolution isn't "new for the sake of new" โ it's about solving the pain points of the previous phase.Phase 1 โ Phase 2: From "can't move" to "can move." This is a qualitative leap โ web pages become interactive, but at the cost of messy code. Phase 2 โ Phase 3: From "usable" to "delightful." Component-based development makes code reusable like building blocks, dramatically improving development efficiency. Core insight: Technological evolution isn't "new for the sake of new" โ it's about solving the pain points of the previous phase.
------
------
What were the earliest web pages like? Why weren't frameworks needed back then? Understanding the limitations of this phase helps you see why later evolutions were necessary.What were the earliest web pages like? Why weren't frameworks needed back then? Understanding the limitations of this phase helps you see why later evolutions were necessary.
Development approach:Development approach:
Characteristics:Characteristics:
`` project/ โโโ index.html โโโ login.html โโโ css/ โ โโโ bootstrap.css โ โโโ custom.css โโโ js/ โ โโโ jquery.js โ โโโ app.js โโโ images/ `` Problems encountered: 1. Global variable pollution: All variables live in the global namespace, easy to overwrite each other 2. Dependency management chaos: JS files must be loaded in the correct order, otherwise errors occur 3. Code hard to reuse: To reuse a feature, you can only copy and paste`` project/ โโโ index.html โโโ login.html โโโ css/ โ โโโ bootstrap.css โ โโโ custom.css โโโ js/ โ โโโ jquery.js โ โโโ app.js โโโ images/ `` Problems encountered: 1. Global variable pollution: All variables live in the global namespace, easy to overwrite each other 2. Dependency management chaos: JS files must be loaded in the correct order, otherwise errors occur 3. Code hard to reuse: To reuse a feature, you can only copy and paste
You may have heard the term "image slicing." It was the main task of early frontend work:You may have heard the term "image slicing." It was the main task of early frontend work:
What is image slicing?What is image slicing?
A designer creates a page layout in Photoshop โ the frontend developer slices the design into small images โ uses HTML to piece the images together into a pageA designer creates a page layout in Photoshop โ the frontend developer slices the design into small images โ uses HTML to piece the images together into a page
Why was it so slow?Why was it so slow?
Every small image on a web page required a separate network request from the browser. More requests meant slower loading.Every small image on a web page required a separate network request from the browser. More requests meant slower loading.
๐ Try it yourself: Observe how image requests affect loading performance๐ Try it yourself: Observe how image requests affect loading performance
To reduce the number of requests, the "CSS sprite" technique emerged: combining many small images into one large image. The advantage was fewer requests; the downside was that creating and maintaining them was a hassle. The lesson from this phase: too many requests is the enemy of performance.To reduce the number of requests, the "CSS sprite" technique emerged: combining many small images into one large image. The advantage was fewer requests; the downside was that creating and maintaining them was a hassle. The lesson from this phase: too many requests is the enemy of performance.
------
------
Why was jQuery needed? What problems did it solve, and what new problems did it create? Understanding jQuery's limitations helps you appreciate the value of Vue/React.Why was jQuery needed? What problems did it solve, and what new problems did it create? Understanding jQuery's limitations helps you appreciate the value of Vue/React.
As web pages grew more complex, the problems of vanilla JavaScript became apparent:As web pages grew more complex, the problems of vanilla JavaScript became apparent:
jQuery was born. It made JavaScript simpler:jQuery was born. It made JavaScript simpler:
javascript // Vanilla JavaScript (verbose) const element = document.getElementById('title') // jQuery (concise) const element = $('#title')
jQuery's core approach is imperative: you tell the browser "how to do it."jQuery's core approach is imperative: you tell the browser "how to do it."
javascript // Find the title element $('#title').text('New Title') // Find the button and disable it $('#submit-btn').attr('disabled', true) // Find the list and add an item $('ul').append('<li>New Item</li>')
The problem: You need to remember every element on the page, and every time data changes, you must manually update all related elements.The problem: You need to remember every element on the page, and every time data changes, you must manually update all related elements.
๐ Try it yourself: Compare jQuery and data-driven approaches๐ Try it yourself: Compare jQuery and data-driven approaches
Imagine you're building a shopping cart: ``javascript // User clicks "Add to Cart" function addToCart() { cartCount++ // Data changes // You have to manually update every related spot $('#cart-count').text(cartCount) // Top-right badge $('#cart-page-count').text(cartCount) // Cart page $('#checkout-price').text(calculatePrice()) // Checkout button // If you miss one spot, the page becomes inconsistent! } `` This is the cost of "manual labor": error-prone and hard to maintain.Imagine you're building a shopping cart: ``javascript // User clicks "Add to Cart" function addToCart() { cartCount++ // Data changes // You have to manually update every related spot $('#cart-count').text(cartCount) // Top-right badge $('#cart-page-count').text(cartCount) // Cart page $('#checkout-price').text(calculatePrice()) // Checkout button // If you miss one spot, the page becomes inconsistent! } `` This is the cost of "manual labor": error-prone and hard to maintain.
Another major shift in this phase: phones and tablets became mainstream.Another major shift in this phase: phones and tablets became mainstream.
Web pages had to adapt to different screens. This required responsive layout: the same HTML/CSS automatically adjusts layout based on screen width.Web pages had to adapt to different screens. This required responsive layout: the same HTML/CSS automatically adjusts layout based on screen width.
The core of responsive layout: Media QueriesThe core of responsive layout: Media Queries
css /* Desktop screens (wider than 640px) */ @media (min-width: 640px) { .container { display: flex; } } /* Mobile screens (narrower than 640px) */ @media (max-width: 640px) { .container { display: block; } }
๐ Try it yourself: Resize your browser and observe responsive layout in action๐ Try it yourself: Resize your browser and observe responsive layout in action
Imagine viewing the same photo in different rooms: - In a large living room (desktop screen), the photo can be displayed larger, with room for other decorations - In a small bedroom (phone screen), the photo needs to be smaller, and other decorations need to be put away Responsive layout is the "smart picture frame" that automatically adjusts how things are displayed based on the room size.Imagine viewing the same photo in different rooms: - In a large living room (desktop screen), the photo can be displayed larger, with room for other decorations - In a small bedroom (phone screen), the photo needs to be smaller, and other decorations need to be put away Responsive layout is the "smart picture frame" that automatically adjusts how things are displayed based on the room size.
------
------
Why do we need Vue/React? What is the essential difference between them and jQuery? Understanding "declarative" and "data-driven" is key to mastering modern frontend frameworks.Why do we need Vue/React? What is the essential difference between them and jQuery? Understanding "declarative" and "data-driven" is key to mastering modern frontend frameworks.
The problems of the jQuery era accumulated to a tipping point:The problems of the jQuery era accumulated to a tipping point:
Vue / React's core approach: just change the data, and the page updates automatically.Vue / React's core approach: just change the data, and the page updates automatically.
jQuery (Imperative):jQuery (Imperative):
javascript // You tell the browser every step to take $('#title').text('New Title') $('#title').css('color', 'red') $('#title').show()
Vue (Declarative):Vue (Declarative):
javascript // You just tell the browser "what to display" data() { return { title: "New Title", color: "red", visible: true } }
๐ Try it yourself: Compare imperative and declarative approaches๐ Try it yourself: Compare imperative and declarative approaches
It's like painting a picture: - Imperative: You tell the painter "pick up the brush, dip it in red paint, draw a circle at coordinates (10, 10)" - Declarative: You hand the painter a photo and say "paint it like this" Vue/React is "declarative": you describe "what the page should look like," and the framework handles "how to draw it."It's like painting a picture: - Imperative: You tell the painter "pick up the brush, dip it in red paint, draw a circle at coordinates (10, 10)" - Declarative: You hand the painter a photo and say "paint it like this" Vue/React is "declarative": you describe "what the page should look like," and the framework handles "how to draw it."
Vue / React's most powerful feature is component-based development: breaking the page into independent "building blocks."Vue / React's most powerful feature is component-based development: breaking the page into independent "building blocks."
Imagine you're building with LEGO:Imagine you're building with LEGO:
Benefits of components:Benefits of components:
- See โ This is a component - See import xxx from './xxx.vue' โ Importing a component - See props: {...} โ Parameters the component receives - See emit('xxx') โ Component sending an event to its parent- See โ This is a component - See import xxx from './xxx.vue' โ Importing a component - See props: {...} โ Parameters the component receives - See emit('xxx') โ Component sending an event to its parent
The Vue / React era brought another major shift: from MPA to SPA.The Vue / React era brought another major shift: from MPA to SPA.
MPA (Multi-Page Application):MPA (Multi-Page Application):
SPA (Single-Page Application):SPA (Single-Page Application):
๐ Try it yourself: Experience the difference between MPA and SPA๐ Try it yourself: Experience the difference between MPA and SPA
SPA advantages:SPA advantages:
------
------
Is the page generated on the server or in the browser? Different rendering strategies have different trade-offs โ choosing the right one is critical for performance and SEO.Is the page generated on the server or in the browser? Different rendering strategies have different trade-offs โ choosing the right one is critical for performance and SEO.
CSR (Client-Side Rendering):CSR (Client-Side Rendering):
SSR (Server-Side Rendering):SSR (Server-Side Rendering):
SSG (Static Site Generation):SSG (Static Site Generation):
๐ Try it yourself: Compare the characteristics of different rendering strategies๐ Try it yourself: Compare the characteristics of different rendering strategies
- Content sites (blogs, documentation): Prefer SSG - Dynamic sites needing SEO (e-commerce, news): Use SSR - Admin dashboards: Use CSR - Mixed requirements: Consider hybrid rendering with Nuxt/Next.js- Content sites (blogs, documentation): Prefer SSG - Dynamic sites needing SEO (e-commerce, news): Use SSR - Admin dashboards: Use CSR - Mixed requirements: Consider hybrid rendering with Nuxt/Next.js
------
Why does frontend need "engineering"? What do build tools actually do? Understanding engineering helps you grasp the workflow of modern frontend projects.Why does frontend need "engineering"? What do build tools actually do? Understanding engineering helps you grasp the workflow of modern frontend projects.
Frontend projects have grown too large to rely on "manually including scripts."Frontend projects have grown too large to rely on "manually including scripts."
Engineering means using tools and standards to make development more efficient, code more reliable, and collaboration smoother.Engineering means using tools and standards to make development more efficient, code more reliable, and collaboration smoother.
Imagine cooking at home vs. running a restaurant: - Cooking at home: Cook whatever you want, very free-form - Running a restaurant: Requires standardized recipes, standardized procedures, unified ingredient sourcing Frontend development is the same: - Small projects: Write however you like - Large projects: Need unified code standards, automated tools, standardized processesImagine cooking at home vs. running a restaurant: - Cooking at home: Cook whatever you want, very free-form - Running a restaurant: Requires standardized recipes, standardized procedures, unified ingredient sourcing Frontend development is the same: - Small projects: Write however you like - Large projects: Need unified code standards, automated tools, standardized processes
Webpack (Traditional):Webpack (Traditional):
Vite (Modern):Vite (Modern):
| Comparison | Webpack | Vite | Improvement |
|---|---|---|---|
| Cold start | 30s+ | <1s | 30x faster |
| Hot reload | 3โ5s | <100ms | 30x faster |
| Config file | Hundreds of lines | Dozens of lines | Drastically simplified |
Webpack is like moving house with everything packed: bundle everything first, then head out. Vite is like traveling light: only bring the essentials, buy what you need along the way. In development, most of the time you're only modifying a few files. Vite only compiles those files โ of course it's fast.Webpack is like moving house with everything packed: bundle everything first, then head out. Vite is like traveling light: only bring the essentials, buy what you need along the way. In development, most of the time you're only modifying a few files. Vite only compiles those files โ of course it's fast.
------
------
What are the characteristics of Vue, React, Svelte, and Angular? How do you choose the right framework? Understanding their design philosophies and use cases helps you make informed decisions.What are the characteristics of Vue, React, Svelte, and Angular? How do you choose the right framework? Understanding their design philosophies and use cases helps you make informed decisions.
| Feature | Vue | React | Svelte | Angular |
|---|---|---|---|---|
| Design Philosophy | Progressive framework | UI library | Compile-time framework | Complete platform |
| Learning Curve | โญโญ Easy | โญโญโญ Moderate | โญโญ Easy | โญโญโญโญ Steep |
| Performance | Fast | Fast | Extremely fast | Fast |
| Ecosystem | Mature | Most mature | Growing | Mature |
| Bundle Size | Small | Medium | Smallest | Large |
| Best For | Small-to-medium projects | Large projects | Performance-critical | Enterprise applications |
| Backed By | Evan You (Independent) | Meta | Community |
Core philosophy: Adopt incrementally โ use just a part or the full suiteCore philosophy: Adopt incrementally โ use just a part or the full suite
vue <template> <div>{{ message }}</div> </template> <script> export default { data() { return { message: 'Hello Vue' } } } </script>
Pros:Pros:
Cons:Cons:
Best for:Best for:
Core philosophy: Focus only on the view layer; everything else is left to the communityCore philosophy: Focus only on the view layer; everything else is left to the community
jsx function App() { const [message, setMessage] = useState('Hello React') return <div>{message}</div> }
Pros:Pros:
Cons:Cons:
Best for:Best for:
Core philosophy: No virtual DOM โ compiles components into efficient native code at build timeCore philosophy: No virtual DOM โ compiles components into efficient native code at build time
svelte <script> let message = 'Hello Svelte' </script> <div>{message}</div>
Pros:Pros:
Cons:Cons:
Best for:Best for:
Core philosophy: Provides a complete, out-of-the-box solutionCore philosophy: Provides a complete, out-of-the-box solution
typescript @Component({ selector: 'app-root', template: '<div>{{ message }}</div>' }) export class AppComponent { message = 'Hello Angular' }
Pros:Pros:
Cons:Cons:
Best for:Best for:
------
Frontend technology evolution is essentially about solving two problems:Frontend technology evolution is essentially about solving two problems:
| Era | Development Approach | Efficiency |
|---|---|---|
| 2000s | Hand-written HTML/CSS/JS | โญ |
| 2010s | jQuery + manual DOM manipulation | โญโญ |
| 2020s | Vue/React + data-driven | โญโญโญ |
| Today | Component-based + engineering + automation | โญโญโญโญโญ |
| Era | Project Scale | Collaboration Style |
|---|---|---|
| 2000s | A few files | One person can maintain |
| 2010s | Dozens of files | Small team, prone to conflicts |
| 2020s | Hundreds of files | Medium team, needs standards |
| Today | Thousands of files | Large team, needs full engineering system |
------
------
Step 1: HTML/CSS/JavaScript FundamentalsStep 1: HTML/CSS/JavaScript Fundamentals
Step 2: Learn a Framework (Vue Recommended)Step 2: Learn a Framework (Vue Recommended)
Step 3: Build a Real ProjectStep 3: Build a Real Project
Advanced directions:Advanced directions:
------
After reading this chapter, you should be able to:After reading this chapter, you should be able to:
When using AI for your projects, you can tell it things like: - "This is a blog site that needs SEO โ use Nuxt (Vue's SSR framework)" - "This is an admin dashboard โ use Vue + Element Plus, no SSR needed" - "This is a performance-critical web app โ consider using Svelte" - "The project is already on React โ continue with the React ecosystem"When using AI for your projects, you can tell it things like: - "This is a blog site that needs SEO โ use Nuxt (Vue's SSR framework)" - "This is an admin dashboard โ use Vue + Element Plus, no SSR needed" - "This is a performance-critical web app โ consider using Svelte" - "The project is already on React โ continue with the React ecosystem"
------
| Term | English | Plain-English Explanation |
|---|---|---|
| DOM | Document Object Model | Represents the page as an object tree, readable and writable by JS. |
| jQuery | โ | An early popular JS library that simplified DOM manipulation. |
| Vue/React | โ | Modern frontend frameworks using data-driven and component-based development. |
| Component | Component | A reusable UI unit, such as a button, card, or navigation bar. |
| MPA | Multi-Page Application | Each navigation reloads the entire page. |
| SPA | Single-Page Application | Loads once; subsequent navigations don't refresh the page. |
| Routing | Routing | The rules and process for managing navigation between pages. |
| SSR | Server-Side Rendering | The server generates HTML and sends it to the browser. |
| SSG | Static Site Generation | Pages are pre-rendered as static HTML at build time. |
| CSR | Client-Side Rendering | The browser generates the page via JavaScript. |
| Webpack | โ | Traditional bundler โ bundles first, then serves. |
| Vite | โ | Modern build tool โ compiles on demand, extremely fast. |
| Responsive | Responsive Design | Design that automatically adapts to different screen sizes. |
| Media Query | Media Query | CSS conditional statements that apply different styles based on screen width. |
| Imperative | Imperative | Telling the program "how to do it." |
| Declarative | Declarative | Telling the program "what you want." |
| Data-Driven | Data-Driven | Only modify the data; the UI updates automatically. |
| Tree Shaking | โ | Automatically removes unused code to reduce bundle size. |
| Code Splitting | Code Splitting | Splitting code into smaller chunks, loaded on demand. |