โ† Back to list

โš›๏ธ React.js? Why? ๐Ÿค”

When it comes to front-end development, the first JavaScript library/framework that pops into developersโ€™ minds is usually React, Vue, orโ€ฆ

Yousef Fatouraee ยท 2025-08-10 02:25 ยท 0 claps ยท 1.6 min read
#web-components #javascript #es2020 #react #user-interface
Open on Medium โ†—
Wiki topics: UX ยท UI/UX Design ๐ŸŒ ยท Web Development ๐Ÿ“š ยท Books & Reading

โš›๏ธ React.js? Why? ๐Ÿค”

When it comes to front-end development, the first JavaScript library/framework that pops into developersโ€™ minds is usually React, Vue, or maybe Angular.

Why do we need to utilize them? Well, the answer is we donโ€™t! Developers probably use them for the following reasons:

  1. Component-Based (the main reason, probably) ๐Ÿงฉ Reusable UI pieces (vs. manual DOM updates). โ™ป๏ธ
  2. Virtual DOM / Reactivity โš›๏ธ Faster rendering (vs. slow direct DOM manipulation).
  3. State Management โšก Centralized data flow (vs. scattered event listeners).
  4. Ecosystem & Tooling ๐Ÿ› ๏ธ DevTools, routers, SSR (vs. DIY solutions).
  5. Scalability ๐Ÿš€ Maintainable for large apps (vs. spaghetti code).

Personally, I value leaner projects and making the front-end as light as possible, by avoiding unnecessary dependencies. Now, is there a way to cover the same features, without installing any third-party library? The answer is almost yes, Web Components, since 2016 (with full cross-browser support by 2020). ๐ŸŽ‰

Web Components are built on three main concepts:

  1. Shadow DOM (Encapsulation) ๐Ÿงฉ Isolates a componentโ€™s DOM and styles from the rest of the page. Prevents CSS/JS conflicts (e.g., .button wonโ€™t leak outside the component).
  2. Custom Elements (Reusability) โ™ป๏ธ Lets you define new HTML tags (e.g., <my-button>). Lifecycle hooks (e.g., connectedCallback()) for dynamic behavior.
  3. HTML Templates (Efficiency) ๐ŸŽจ <template> tags define markup thatโ€™s parsed but not rendered until cloned. Avoids runtime HTML parsing (better performance for reusable UI).

Key characteristics of Web Components:

  1. Framework-Agnostic โœ… Works anywhere โ€” Embeddable in vanilla JS or even React, Vue, or Angular. โœ… No lock-in โ€” Avoid dependency on React/Vueโ€™s ecosystem.
  2. Native Browser Standards โœ… Long-term stability โ€” Wonโ€™t go obsolete like frameworks might. โœ… No build step, bundler or transpiler needed.
  3. True Encapsulation (Shadow DOM) โœ… Scoped styles/CSS isolation โ€” No accidental overrides. โœ… Self-contained DOM โ€” Prevents external JS from breaking your component.
  4. Performance โœ… Lightweight โ€” No Virtual DOM overhead (direct DOM updates). โœ… Efficient for static/mostly-static UI.
  5. Microfrontend & Legacy Integration โœ… Runs alongside old jQuery/Backbone apps. โœ… Good for gradual modernization.
  6. Cross-Platform Portability โœ… Works in any JS environment (even non-web, like Electron). โœ… Supported by all major browsers (since ~2020).

React is embraced by a huge ecosystem and beginner-friendly abstractions, while Web Components provides a lightweight, native alternative with true encapsulation, and a little more Object Oriented Programming. React would work better for Single-Page-Apps while Web Components could be better for framework-free and performance-critical projects, built to last.

Which one would you choose?


๋ฉ”ํƒ€๋ฐ์ดํ„ฐ
post_id
be4fd49889d2
slug
๏ธ-react-js-why-be4fd49889d2
url
https://medium.com/@modulessoft/%EF%B8%8F-react-js-why-be4fd49889d2
canonical_url
https://medium.com/@modulessoft/%EF%B8%8F-react-js-why-be4fd49889d2
author_url
https://medium.com/@modulessoft
status
ok
fetched_at
2026-07-18 09:10:59