Live data from Hacker News

Ask HN: How does one build large front end apps without a framework like React?

news.ycombinator.com

131–140 of 197 posts

Re: Ask HN: How does one build large front end apps without a framework like React?

#131
post #92

Earlier quoted context omitted.

When you're writing only a "couple lines of code", you can do pretty much anything you want. There's no real tradeoffs to discuss except in a theoretical sense, because the stakes are so small. If the app being built is "large" (which I understand to mean, has high essential complexity), then those tradeoffs matter a lot. If the app is built by a team instead of an individual, the people problems become significant.…

> When you're writing only a "couple lines of code", you can do pretty much anything you want. There's no real tradeoffs to discuss except in a theoretical sense, because the stakes are so small. The JavaScript logic in the browser is comparatively small compared to the total application. This is absolutely more true when you remove the bloat imposed by a large framework. Frameworks do not exist to alleviate problems…

That you believe frameworks were invented to serve employers is a cynical point of view. I'm sorry for whatever bad experience you've had with the frameworks or people using them that caused you to develop this viewpoint.

A developer choosing to use a framework doesn't mean they are reliant on it, any more than choosing a particular language, library, text editor, tool, etc. It simply means they decided it was a helpful way to accomplish their goal, whether that's to save time, or establish consistency, eliminate categories of problems, avoid re-inventing the wheel, etc.

I don't know if you're aware of this, but you're coming off as incredibly arrogant with your strong claim that frameworks are used by those who don't know better. It's easy on the internet to vaguely gesture at "developers", but most of us are individual who've built software with real users among other demonstrated accomplishments. Strong claims require strong evidence, I hope you have the arguments to back it up.

Re: Ask HN: How does one build large front end apps without a framework like React?

#132
post #95

Earlier quoted context omitted.

Framework is unfortunately a term that's both ill-defined and quite overloaded. Electron is a framework in a very different sense than the "JS frameworks" op is asking about. The latter is about libraries with APIs and mental models for producing the UI & UX of web applications. Electron is just a way of running Chrome without the Chrome UI around it, + a few APIs for accessing native OS APIs. You wouldn't say that C…

> Electron is a framework in a very different sense than the "JS frameworks" op is asking about. The OP doesn't have a good understanding of what they're asking about, and that's okay. That's why they asked the question. The linked thread is titled "What framework did the developer use to create Obsidian desktop application?". It's not asking about a web application and specifically referencing a desktop framework wi…

I mean, you're correct that Obsidian doesn't run on the browser. But it's built on web technologies. As a result, I would argue that the overlap between the skillset and work needed to build an app like Obsidian overlaps more with most web applications than most desktop and mobile applications.

You're also correct that Electron provides APIs beyond those available in the browser, such as access to the native filesystem. The way I see it, those are mostly some lower-level details it wouldn't be that hard to run Obsidian in the browser, it's just a product choice not to (specifically, it would imply creating a file hosting service). As the Obsidian mobile app demonstrates, Electron is swappable and not needed for Obsidian's core functionality. In contrast, had Obsidian been built on React, it would be rather difficult to simply "run without React" without rewriting the entire application.

How to build a large front-end app on non-web technologies (Swift, C++/QT, C#, etc) is also an interesting question but I didn't understand that as being the topic of this conversation.

Re: Ask HN: How does one build large front end apps without a framework like React?

#133
post #128

Earlier quoted context omitted.

a b ... ... const $ = name => document.querySelector(name) $('#dropdown').addEventListener('change', ev => { $('#a').style.display = ev.target.value == "a"? "block" : "none" $('#b').style.display = ev.target.value == "b"? "block" : "none" } vs const [showing, setShowing] = useState(null) const handleChange = ev => setShowing(ev.target.value) let other if(showing == "a") other = ... if(showing == "b") other = ... retu…

Yes and then add few other pieces of state and interdependent components, the reactive code will extend, the manual patch job of connecting listeners and mutating DOM will start falling apart. The first example is okay for a one off but can't be reused as a component. It's also easy to get in a place where you have to update 3-4 different handlers to include a logic change. In a component based library/framework, you…

I agree separating your UI into components is important. If React learned us one thing it is that keeping related stuff together is the way to go. Separating into components and keeping your functions as pure as possible gives you 95% of what makes React great! You can read my answer to @iliaznk on how I do this.

cleaning up listeners or cleaning up DOM nodes is rarely needed. Just remove the component element and the browser cleans up automatically.

Re: Ask HN: How does one build large front end apps without a framework like React?

#134
post #132

Earlier quoted context omitted.

> Electron is a framework in a very different sense than the "JS frameworks" op is asking about. The OP doesn't have a good understanding of what they're asking about, and that's okay. That's why they asked the question. The linked thread is titled "What framework did the developer use to create Obsidian desktop application?". It's not asking about a web application and specifically referencing a desktop framework wi…

I mean, you're correct that Obsidian doesn't run on the browser. But it's built on web technologies. As a result, I would argue that the overlap between the skillset and work needed to build an app like Obsidian overlaps more with most web applications than most desktop and mobile applications. You're also correct that Electron provides APIs beyond those available in the browser, such as access to the native filesyst…

You can just admit you were wrong instead of continuing to move the goalposts. :)

Re: Ask HN: How does one build large front end apps without a framework like React?

#135

Earlier quoted context omitted.

None of these are problems taken separately, but put together they're pretty frustrating. Hooks being 5 years old and being the predominant tool for certain tasks shows that the community only figured out how to solve a particular problem 5 years ago. Compare that, in terms of stability, to Python having coming up with the idea of packages a long time ago, and packages are now a stable part of the ecosystem (packag i…

> None of these are problems taken separately, but put together they're pretty frustrating. Hooks being 5 years old and being the predominant tool for certain tasks shows that the community only figured out how to solve a particular problem 5 years ago. Hooks are ~~7~~ 6 years+8months old, almost 7 years. This may not seem like a significant difference, but IMO it puts them 75% of the way back in time to when react t…

Saying hooks is "seven years old" is just being pedantic. I worked on a major project in 2019 where making the decision to use hooks was a huge leap of faith. It did not become the default way of writing React code until 2020/2021, so five years is more than accurate enough.

- Dan Abramov's first big conference talk was in October 2018

- The official release was in React 16.8, February 2019 - that's six years ago

Re: Ask HN: How does one build large front end apps without a framework like React?

#136
post #132

Earlier quoted context omitted.

I mean, you're correct that Obsidian doesn't run on the browser. But it's built on web technologies. As a result, I would argue that the overlap between the skillset and work needed to build an app like Obsidian overlaps more with most web applications than most desktop and mobile applications. You're also correct that Electron provides APIs beyond those available in the browser, such as access to the native filesyst…

You can just admit you were wrong instead of continuing to move the goalposts. :)

Everyone else in this thread is talking about (React/Angular/Vue/JQuery/etc) v.s. (Plain JS/Direct DOM manipulation/etc). Running that code on top of Electron or not is entirely orthogonal. So I admit I'm confused why you're fixated on bringing Electron into the conversation. Op's question appears to me like it references the last part of the linked thread: "I’d like to know what JavaScript framework (e.g. Vue, React) Obsidian desktop application is using for creating the user interface?"

Since we seem to be talking past each other, what do you think the conversation is about?

Re: Ask HN: How does one build large front end apps without a framework like React?

#137

Every time a company refuses to use a framework for a large web project, they end up reproducing all of its features - badly. And, when a new developer comes in who knows React, they can ramp up fast and even if they don’t, there are plenty of resources instead of asking Bob how something works - if Bob is even still working there.

This is one of the myths that feeds React's popularity. The few times I had the chance to be part of a project using an in-house framework, it was actually quite pleasant.

You can (and they will) build a massive house of cards on top of anything, in reality that new React dev will the take the same amount of time to ramp up, or worse if you're not careful. Learning the extensive collection of libraries in use, how they are glued together, application architecture, entry points, data and state management, build, deployment, asset management, etc is what takes most of that time. Having documentation for APIs can't help you there.

Re: Ask HN: How does one build large front end apps without a framework like React?

#138

Every time a company refuses to use a framework for a large web project, they end up reproducing all of its features - badly. And, when a new developer comes in who knows React, they can ramp up fast and even if they don’t, there are plenty of resources instead of asking Bob how something works - if Bob is even still working there.

This is one of the myths that feeds React's popularity. The few times I had the chance to be part of a project using an in-house framework, it was actually quite pleasant. You can (and they will) build a massive house of cards on top of anything , in reality that new React dev will the take the same amount of time to ramp up, or worse if you're not careful. Learning the extensive collection of libraries in use, how t…

You’re still not taking into account resume driven development when they get ready for that next job. Would they rather say I built the website using Bob’s bespoke framework or React?

Re: Ask HN: How does one build large front end apps without a framework like React?

#139
As an old developer 30+ years. I love to build from scratch with no frameworks, but it is not viable for corporate development requirements. For many personal and yes large projects I still write from scratch. I will be the first to admit I hate building pretty sites so mainly focus on functionality rather than look and feel. Again corporate world would hate that. Frameworks make things easier, and faster, and yeah mostly run better. But they do lose the details of developer really knowing what every bit is used for, and how they made it work.

Re: Ask HN: How does one build large front end apps without a framework like React?

#140

Earlier quoted context omitted.

When I want to memoize something slightly complex, for simplicity's sake let's say sorting an array of objects based on one of it's keys. I can put that in a useMemo and it won't sort it again when the page eventually rerenders for some reason. Usually that array is mapped elsewhere and those child components might also re render if the array is recalculated. useEffects are when I need to call something outside of re…

> all criticisms welcome :) No criticism really. Your useMemo example is the right use. Your useEffect use is fine, but for things like api calls (which 'call something outside of react' may refer to), you're often better leaning on something like react-query, which is of course built on top of useEffect. So still the right tool, but let others handle many of the sharp edges around that problem.

Thanks. I've started with rtk and saga hence the useEffect. I've since moved to rtk query.
Post reply on HN