5 ms·
This is hilarious. Those web apps are single page applications, more application than page. The most of what face book does in the background has nothing to do
by posterboy 4y ago
This is hilarious. Those web apps are single page applications, more application than page. The most of what face book does in the background has nothing to do with what the user can see, for example. A chat might require interactivity, but static designs with push and pull work well enough for many use cases, with sparse scripting. The bespoke tutorials might rather target a geocities homepage, admittedly.
It's funny to see how responses in this thread jump immediately to reactivity or "skills you can reuse across projects" but without making the case: why?
- solardev 4y agoWhy what? Facebook is pretty complicated already, once you factor in: * infinite scroll * different sorting algorithms (top vs new, do they even still have that?) * real-time commenting and post updates, with responses, reactions, edits, deletions * dynamic image uploads, resizes, rotations, captions, etc. * auth * multi-device sync * real-time customizable notifications * real-time sharing And then it gets even more complicated when you throw in other features like: * ad management, posting, analytics, event tracking * chat * marketplace * page management and all the permissions and delegations that involves There's nothing really "static" about Facebook. And even it was designed as a mix of PHP and clientside JS, probably due to its history... if they started from scratch today, who knows what architecture they'd use, but probably not vanilla JS and HTML... I think the "why" should be aimed more at vanilla, as in "why would you want to reinvent the wheel when there are so many battle-tested solutions to choose from, each made by a team hundreds of times more resourced than you"
- paulryanrogers 4y agoWhy go vanilla? Because it's less complex, often smaller over the wire, nearly SEO ready, etc. Of course if you can anticipate needing a lot of interactivity which cannot wait for separate page loads then consider the FE frameworks. Maybe even go hybrid if only one or two pages need app-like components. Right tool for the job is hard to know before you've done a similar job, so I can relate to wanting to start with the most robust hammer.
- abareplace 4y agoThe thing is, most web sites are not Facebook. React is usually an overkill; you don't have so many moving parts in a typical web UI.
- solardev 4y agoWell, Facebook was the example provided, and I was just saying that there's a lot of nuance to what (at first) might just look like a static list of posts but really isn't. I don't think it's a matter of React or not, but how much clientside interactivity & loading you want. If you want more than trivial interactivity -- immediately or in the future -- then a framework makes it a lot easier. Even something like jQuery existed because the DOM was so hard to work with, and thankfully ECMAScript has absorbed some of jQuery's features. React and node are doing something similar, forcing the standardization of ES6 Modules and Web Components, for example. They come up with ideas, implement them, see them adopted, and THEN the standards bodies absorb them. Nothing stops you from using vanilla JS across your whole project if you want to; many devs just consider it an unnecessary pain that prioritizes purity of ideology over real-world concerns. I disagree that there aren't many moving parts in a typical web UI. Everything today from basic ecommerce to dashboards to maps to search to comments use clientside JS to enhance interactivity and AJAX loading. If you're building something simpler, there's probably no reason to code your own site anymore vs using Wordpress/Shopify/Bootstrap/whatever. For the more complex cases that full-time devs actually get paid to build, using a framework and dealing with its performance/bundle size considerations is usually easier than using vanilla JS and dealing with its shortcomings, or you end up having to invent a lightweight framework yourself. That's especially true when you have (or want) a team larger than one person. With a conventions-based framework, any new dev can be pretty quickly onboarded by observing your usage of common patterns in that framework. See a "useState" and "useContext" and they know its intent immediately. If you roll your own system in vanilla JS, without any standard patterns or naming conventions or directory hierarchies, even the most trivial change requires teaching or a deep investigation -- especially once you get into sharing state across more than one component/page. I mean, this isn't even a hypothetical... the web evolved from basic DHTML-era JS to jQuery to Angular to React and its peers because more and more people saw a need for these frameworks. Nobody forced it on the web community, we just saw how they helped solve problems we had. Many jobs had me rewriting old PHP + JS apps into modern frameworks because, well, it just works better and is easier to maintain afterward. Facebook itself is an example of that progression. If you remember Facebook when it first launched, it was pretty limited and much slower (in terms of interactivity). (It was also a lot cleaner and not so ad-ridden and toxic, sadly). I think they invented React out of real needs, not "how do we add more overkill to our app". Sorry... I guess that's just a longwinded way of saying I disagree that there aren't moving parts in a typical web UI anymore, at least in the space of full-time jobs. Small local businesses and whatever, well, they can just use any of the DIY frameworks (Wix, SquareSpace, Square, etc.). But for those of us actually building SaaS or similar products, vanilla just doesn't cut it. Really the only time I can see vanilla JS paying off is simple one-off blogs or lone marketing pages, etc. And most paying dev jobs aren't doing such simple things anymore...