TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Will Web Components Replace React?

8 点作者 roschdal超过 1 年前
Ask HN: Will Web Components replace React? :)<p>https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;Web_components

4 条评论

dtagames超过 1 年前
None of these HTML-based technologies ever really replaces the others, but certainly web components make some use cases easier than React -- and make quite a few things possible that would be nearly impossible in React.<p>The best example right now is the new Photoshop for the web, which runs entirely in the browser and is made with web components and Lit. Fighting the &quot;React way&quot; to build something like PS would be a nightmare. But web components are a blank slate. You don&#x27;t have to fight anything; you do have to built it the way you want it to work.<p>The extra building work includes ugly plumbing stuff like routing and state management, but the advantage is that you get to build those the way you want them to work, too.<p>In the cases where you&#x27;re building an app with off-the-shelf kind of UI components and behaviors, a framework like React or Angular is still a good bet. Web components (and Lit, their &quot;helper glue&quot;) lets every component be entirely custom.<p>I wrote an intro[0] to web components on Medium that&#x27;s been well received if anyone is interested.<p>[0] <a href="https:&#x2F;&#x2F;medium.com&#x2F;gitconnected&#x2F;getting-started-with-web-components-lit-part-1-911aa7058e9b" rel="nofollow noreferrer">https:&#x2F;&#x2F;medium.com&#x2F;gitconnected&#x2F;getting-started-with-web-com...</a>
robertknight超过 1 年前
In general, no. React has been around for over 10 years now, and it generally remains popular and well supported. It is not going anywhere. Some sites will choose to migrate between React and Web-components based frameworks such as Lit for various reasons (technical preferences, standardizing technology stacks within an organization etc). Some sites will combine chunks of UI built with React and chunks of UI built with Web components (eg. by different teams within an organization). Others will create web applications which use Web components for style&#x2F;DOM isolation at the top level, but where web components are built internally with React (which has various tooling and API advantages over WCs at the lower level).
austin-cheney超过 1 年前
You can answer this yourself if you think through it from a business perspective.<p>What problem does react solve? It’s an architecture in a box and it helps developers put text into n screen.<p>Why react? Training developers costs time and money when developers are already a cost center. Worse, not all people claiming to do this work are capable of being trained. So, react becomes a means for employers to select ideal candidates.<p>What value does react provide? Candidate selection and a shared architecture.<p>What is lost by not using react? Developers cannot write original applications and struggle to put text on screen.<p>Can web components do that faster or cheaper than react without training overhead? If so then web components will dominate.
codingdave超过 1 年前
Web components have been around longer than React. They have improved over the years, and they both have their pros&#x2F;cons... but if either one was going to replace the other, that likely would have already occurred.