Table of Contents
1006 words
5 minutes
What Are React and Vue, Really? Understanding Frontend Frameworks from Scratch

1. Introduction#

Many frontend beginners are confused: I’ve already learned HTML/CSS/JavaScript, why do I still need to learn a framework?

Let’s first go back to the original way of writing pages with the “big three”:

//Native approach: manually manipulating the DOM
const list = document.getElementById('todo-list');
const input = document.getElementById('todo-input');
const button = document.getElementById('add-btn');
button.addEventListener('click', () => {
const text = input.value;
const li = document.createElement('li');
li.textContent = text;
const delBtn = document.createElement('button');
delBtn.textContent = 'Delete';
delBtn.addEventListener('click', () => li.remove());
li.appendChild(delBtn);
list.appendChild(li);
input.value = '';
});

This code runs. But as pages get more and more complex, you’ll notice a few pain points:

  1. State and UI are out of sync: When data changes, you have to manually update the DOM (forget, and you get a bug)
  2. Messy code organization: Event listeners, DOM operations, and data handling are all mixed together
  3. Hard to reuse: Switching to another page means copy-pasting, and changing one place easily misses another
  4. Performance optimization is a chore: Which DOM nodes should update and which shouldn’t is all up to you to figure out

Frameworks were born to solve these problems.


2. The Core Idea of Frameworks#

Whether it’s React or Vue, all modern frontend frameworks share the same core idea:

Data (State) → Framework automatically → Interface (UI)

You only need to care about what the data is, and the framework handles turning data into the interface. When data changes, the framework automatically updates the interface — you never have to manually createElement, appendChild, remove again.

Comparison DimensionNative ApproachUsing a Framework
Updating UIManually query DOM → modify → insertChange data → framework auto-updates
Code organizationScattered everywhereComponentized, high cohesion
ReuseCopy-pasteComponents are plug-and-play
PerformanceOptimize it yourselfFramework has built-in diff + minimal updates

3. React: The Functional Philosophy of Data-Driven Views#

3.1 React’s Core Formula#

React views UI as a function of state:

UI = f(State)

This means: given the same state, React renders the same interface. The interface is no longer “modified” — it’s “declared.”

3.2 Describing the Interface with JSX#

React uses JSX — a syntax for writing HTML inside JavaScript:

function TodoList() {
const [todos, setTodos] = useState([]);
const [text, setText] = useState('');
const addTodo = () => {
setTodos([...todos, { id: Date.now(), text, done: false }]);
setText('');
};
const removeTodo = (id) => {
setTodos(todos.filter(t => t.id !== id));
};
return (
<div>
<input
value={text}
onChange={(e) => setText(e.target.value)}
placeholder="Enter a todo item"
/>
<button onClick={addTodo}>Add</button>
<ul>
{todos.map(todo => (
<li key={todo.id}>
{todo.text}
<button onClick={() => removeTodo(todo.id)}>Delete</button>
</li>
))}
</ul>
</div>
);
}

Compared to the native approach, React’s code:

  • No need to manually create DOM elements; just write JSX to describe the structure
  • No need to manually update the DOM; just change the todos array
  • Each feature is encapsulated in a component, clear and cohesive

3.3 React’s Core Concepts#

ConceptDescriptionExample
ComponentThe basic unit of UI; a function returns JSXfunction Card() { return <div>...</div> }
StateMutable data inside a componentconst [count, setCount] = useState(0)
PropsData passed from parent component to child component<Card title="Hello" />
Hooks”Attach” state and side effects to function componentsuseState, useEffect, useRef
Virtual DOMA virtual DOM tree in memory, used to compute minimal updatesFramework internal implementation
One-way data flowData flows from parent component to child componentParent → Child

3.4 React’s Philosophy#

  • Everything is JavaScript: JSX is just syntactic sugar for createElement()
  • Immutability: Don’t modify the original data; create new data instead ([...arr, newItem])
  • Explicit updates: You must call setState to trigger a re-render

4. Vue: The Progressive Template Philosophy#

4.1 Vue’s Core Idea#

Vue’s design goal is to be progressive: you can use it as a simple template engine for just one part of a page, or use it to build a complex single-page application.

Vue uses template syntax, treating HTML as the natural carrier for templates:

<template>
<div>
<input
v-model="text"
placeholder="Enter a todo item"
@keyup.enter="addTodo"
/>
<button @click="addTodo">Add</button>
<ul>
<li v-for="todo in todos" :key="todo.id">
{{ todo.text }}
<button @click="removeTodo(todo.id)">Delete</button>
</li>
</ul>
</div>
</template>
<script setup>
import { ref } from 'vue';
const text = ref('');
const todos = ref([]);
function addTodo() {
if (!text.value.trim()) return;
todos.value.push({ id: Date.now(), text: text.value, done: false });
text.value = '';
}
function removeTodo(id) {
todos.value = todos.value.filter(t => t.id !== id);
}
</script>

4.2 Vue’s Core Concepts#

ConceptDescriptionExample
TemplateHTML-based declarative template<template> block
Reactive dataThe view auto-updates when data changesref(), reactive()
DirectivesSpecial attributes starting with v-v-if, v-for, v-model, v-bind
ComponentSingle-File Component .vue<script setup> + <template> + <style>
Two-way bindingv-model achieves two-way sync between data and view<input v-model="text">
ComputedComputed properties based on reactive dataconst doubled = computed(() => count.value * 2)

4.3 Vue’s Philosophy#

  • Template-first: Writes like HTML, friendly to designers and backend developers
  • Reactive system: When data changes, everywhere that uses this data auto-updates (implemented with Proxy under the hood)
  • Flexibility: Choose between Options API and Composition API

5. React vs Vue: How to Choose#

Comparison DimensionReactVue
Core ideaUI = f(State), functionalReactive + templates, progressive
Writing styleJSX (write HTML in JS)SFC templates (write logic in HTML)
Data updatesImmutable + explicit setStateMutable + automatic tracking
Learning curveSlightly steep (need to understand Hooks rules)Gentler (templates are intuitive and friendly)
EcosystemHuge, Next.js full-stack solutionMature, Nuxt full-stack solution
CommunityMaintained by Meta, most active communityCommunity-driven, strong Chinese ecosystem
Use casesLarge applications, cross-platform (React Native)Suitable for small-to-medium to large

There is no best framework, only the framework that suits you best. If you like the minimalist philosophy of “everything is JavaScript,” choose React; if you’re more used to the intuitive way of “template + script + style separation,” choose Vue.


6. Frameworks Don’t Mean Abandoning the Fundamentals#

A common misconception: “Once you learn a framework, you don’t need to learn JavaScript anymore.”

In fact, it’s the exact opposite: frameworks are abstractions built on top of the fundamentals, and only by understanding the fundamentals can you truly master a framework. The following skills remain important in framework development:

Fundamental SkillHow It Manifests in Frameworks
ES6 modularityimport / export components
Destructuring assignmentconst { title, content } = props
Array methodsmap, filter, reduce for handling lists
Asynchronous programmingasync/await for handling API requests
ClosuresUnderstanding how Hooks work
Event mechanismsonClick and @click are built on event listeners

7. Summary#

React and Vue are essentially doing the same thing: letting you describe the UI in a declarative way, with the framework responsible for efficiently syncing data to the DOM.

  • React says: “UI is a function of state — treat everything as JavaScript”
  • Vue says: “HTML is the best template — let the reactive system automatically track dependencies”

Once you learn one, you can pick up the other quickly — because they share the same core philosophy: data-driven views.

--- END CONTENT ---

What Are React and Vue, Really? Understanding Frontend Frameworks from Scratch
https://www.hehonglei.com/technology/react-vue-framework-intro/
Author
HHLBlog
Published at
2026-06-17
License
CC BY-NC-SA 4.0