Frontend Development 10 min read

Understanding React: Principles, Component‑Based Architecture, and a Tab Selector Example

This article explains how React addresses the challenges of dynamic data rendering in complex front‑end interfaces by using a virtual DOM, component‑based architecture, and efficient diffing, and demonstrates these concepts with a practical Tab selector component implementation.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
Understanding React: Principles, Component‑Based Architecture, and a Tab Selector Example

Developing front‑end interfaces based on HTML is becoming increasingly complex, mainly because dynamic data from the server or user input must be efficiently reflected in the UI; React, a framework from Facebook, is designed specifically to solve this problem for large applications with constantly changing data.

Common misconceptions about React:

React is not a full MVC framework; it is essentially the View layer.

Server‑side rendering is an optional add‑on, not the core purpose of React.

React can be used together with Web Components, not as a direct competitor.

React is not a new templating language; JSX is merely syntactic sugar and React works without it.

React’s Core Principle

React introduces a Virtual DOM: every UI update rebuilds an in‑memory DOM tree, compares it with the previous tree, and applies only the differences to the real browser DOM. This batch processing of updates within a single event loop reduces unnecessary DOM work and improves performance, allowing developers to focus on the overall UI state rather than manual DOM manipulation.

Traditional server‑side rendering refreshes the whole page for any change; React brings the same whole‑page refresh concept to the front‑end but performs it efficiently, handling local updates internally.

Using a chat‑app example from Facebook, React lets developers think only about data changes, while the framework determines how the UI should evolve.

Component‑Based Development Approach

The Virtual DOM enables a component‑centric mindset: UI pieces are encapsulated as independent, reusable components. Large applications (e.g., Instagram) are built as a hierarchy of nested components, each responsible for its own rendering and logic.

Compared with MVC, which separates view, data, and controller, componentization separates UI functionality into isolated modules, making each part easier to understand, maintain, and test.

Key characteristics of a good React component:

Composable : can be combined or nested within other components.

Reusable : usable across multiple UI scenarios.

Maintainable : contains only its own logic, simplifying comprehension.

Testable : isolated components are straightforward to unit‑test.

Example: Building a Tab Selector Component

The article presents a practical example of a Tab selector used on e‑commerce product pages. It first shows a traditional jQuery plugin implementation (illustrated with images) and then the equivalent React implementation, highlighting how React eliminates the need to manage individual DOM updates; calling setState triggers a full re‑render, simplifying the development logic.

With React, the component’s state can be changed programmatically at any time without additional UI‑update code, demonstrating the advantage of a declarative, data‑driven approach.

Conclusion

React offers a novel front‑end UI framework that abstracts complex local updates, delivers high performance in intricate scenarios, and promotes a component‑based development style that improves efficiency, readability, maintainability, and testability. Its rapid adoption—over 10,000 GitHub stars within a year—suggests a lasting impact on front‑end development and related standards such as Web Components.

frontendreactUI Developmentcomponent architecturevirtual DOM
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.