4 ms·
Web browsers have had callbacks for DOM elements since... forever. Why did we need to add an entire component framework like React on top of it? Everything on
by dolni 5y ago
Web browsers have had callbacks for DOM elements since... forever. Why did we need to add an entire component framework like React on top of it?
Everything on a web page does not need to be interactive. It's a document first.
Web applications are cool. Maybe React makes sense there. _But every site does not need to be a web application!_ And yet somehow, React and company became the industry default.
- culi 5y agoReact doesn't have to be your whole website. Even the starter tutorial in the docs starts off by showing you how to just add in React through a CDN and make a react app as a single component of a bigger webpage Obviously that's not at all how it's used in practice (or even in the create-react-app template), but I do think there's a place for something like React
- eyelidlessness 5y agoI agree with you to the extent that components = interactive. But there are other benefits of a component model, even for pages which are mostly static. They allow you to develop the same page and its various (reusable) parts with the same code for rendering the static parts and the dynamic parts. This is especially nice on sites where the dynamic-to-static ratio may vary significantly between pages, or between areas of the same page. This use case hasn’t been particularly well supported by many component libraries (React among them; Marko being a long time notable exception), but it’s an area that’s currently having a bit of a renaissance: there is of course Marko which has supported this model for years, joined by other notable frameworks like Astro and Qwik. Even React is moving more in this direction with Server Components, just targeting other use cases. The component model will continue to thrive, not because everything is interactive, but because components are an excellent abstraction for developing for the web (and a lot of other formats).