โ๏ธ 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โฆ
โ๏ธ 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:
- Component-Based (the main reason, probably) ๐งฉ Reusable UI pieces (vs. manual DOM updates). โป๏ธ
- Virtual DOM / Reactivity โ๏ธ Faster rendering (vs. slow direct DOM manipulation).
- State Management โก Centralized data flow (vs. scattered event listeners).
- Ecosystem & Tooling ๐ ๏ธ DevTools, routers, SSR (vs. DIY solutions).
- 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:
- 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).
- Custom Elements (Reusability) โป๏ธ Lets you define new HTML tags (e.g., <my-button>). Lifecycle hooks (e.g., connectedCallback()) for dynamic behavior.
- 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:
- Framework-Agnostic โ Works anywhere โ Embeddable in vanilla JS or even React, Vue, or Angular. โ No lock-in โ Avoid dependency on React/Vueโs ecosystem.
- Native Browser Standards โ Long-term stability โ Wonโt go obsolete like frameworks might. โ No build step, bundler or transpiler needed.
- True Encapsulation (Shadow DOM) โ Scoped styles/CSS isolation โ No accidental overrides. โ Self-contained DOM โ Prevents external JS from breaking your component.
- Performance โ Lightweight โ No Virtual DOM overhead (direct DOM updates). โ Efficient for static/mostly-static UI.
- Microfrontend & Legacy Integration โ Runs alongside old jQuery/Backbone apps. โ Good for gradual modernization.
- 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