Live data from Hacker News

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

news.ycombinator.com

81–90 of 197 posts

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

#81
You don't need a "framework". You don't even really need a rendering/state library like React, depending on what you're doing.

If you're having difficulty thinking outside of frameworks, I would suggest you work on a simple project where you don't use anything like Next.js or React. Start with the bare minimum of tools available to you through the browser API and your backend runtime of choice, then add things on as needed. Try implementing your own routing without using a third-party package dedicated to routing. Work on your own component system, state management, or even a rendering abstraction.

I can guarantee that, once you at least near completion on such a pet project, you'll not only have a better appreciation for what frameworks are doing but realize that they're actually quite overrated in a lot of ways. In reality, it's totally feasible to build an application, especially one for the web, with more of your own code and not having to think about it in terms of how your logic fits within a "framework".

At the end of the day, 99% of frameworks is someone else's opinion. This is I think what makes churn in the JS world painful. The majority of changes are based on a developer's opinion of how things should work, but their opinion isn't necessarily better than anyone else's. Your application is not worse because it doesn't use someone's idea of how an elegant state management system should behave. It's not worse because it's doing its own DOM manipulation rather than handing off all that work to an opaque rendering library. The point is to get the job done. You can make a kickass web application with freaking Backbone or jQuery if you wanted to.

It's not that I don't appreciate frameworks, though I do think it's important for programmers to learn how to move beyond them. Frameworks don't have as big a job as many are lead to believe. Their complexity is primarily arbitrary most of the time. It's not that such complexity can't be beneficial, but bypassing said complexity doesn't require a big brain.

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

#82
post #70

Earlier quoted context omitted.

What I'm saying, say you have 3 dependent dropdown pickers, selecting an item in the first one determine which of the other 2 are shown. When you have reactive interfaces like that, it's hard to extract the common "business" logic. Either you redraw everything from scratch or you do a sort of show/hide on DOM elements as in jQuery days. Not sure how you can abstract that. If you do abstract it, you end up with backbo…

You are still thinking in terms of framework goodness, which is why this is challenging for you. Don't do that. Don't redraw anything. Don't create some shallow copy, cloned node, or other insanity. You don't need any of that. You don't need to litter your code, most especially your DOM nodes, with a bunch of business logic insanity. All you need is the event handler. The event handler can be assigned to a node's eve…

I did not understand the event handler part. Could you make an example?

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

#83
IMO: It's good to know how to manipulate the DOM directly. Any complicated web app will always hit some kind of corner case where you need to bypass your framework and manipulate an element. For example, the spinner that you see on https://manage.onopti.com/ is disabled with a pure DOM call once WASM + Blazor is started up.

That being said, as many other comments rightly point out, (for most projects,) if you work directly in the DOM you'll end up recreating what most frameworks do for you. It's really only "worth it" when you can strongly justify it: IE, if you're making a charting library that can handle thousands of datapoints, or a rich degree of interactivity that a usual business web site doesn't have.

But for a typical interactive website: Use whatever framework your peers at your company will be comfortable with.

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

#84

> JS frameworks move really quickly React is a lot more stable than I think you're giving it credit for. > And the stability also means that more time is spent on delivering features Frameworks/libs also exist to save you time, thus letting you spend more time on delivering features. And fwiw, the obsidian team seems to agree in principle. Your link goes to a forum post of some kind, in which one may find a link to o…

> React is a lot more stable than I think you're giving it credit for. Hooks are only 5 years old. The docs were revamped 2 years ago and there's lots of dead links to the old docs page which has a scary warning "These docs are old and won’t be updated." Create-react-app was deprecated in February of this year and in their blog post they tell you to use frameworks like Next.js. And then there's the ecosystem. Next.js…

I'm gonna be honest, I've been developing with react for about 9 years across a lot of projects and companies. I've never used next.

Maybe I'm out of touch, but I don't understand why people think it's so tightly could with the ecosystem

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

#85

Earlier quoted context omitted.

> React is a lot more stable than I think you're giving it credit for. Hooks are only 5 years old. The docs were revamped 2 years ago and there's lots of dead links to the old docs page which has a scary warning "These docs are old and won’t be updated." Create-react-app was deprecated in February of this year and in their blog post they tell you to use frameworks like Next.js. And then there's the ecosystem. Next.js…

> Hooks are only 5 years old. That is a long damn time in this industry, and class-based components still work just fine.

I preferred class based components. The pretend functional programming style of hooks is quite imperative when you prick a little beneath the surface, so classes were probably the right abstraction.

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

#86
You don't need a large framework to build a maintainable, efficient web app. Here's an example: https://github.com/wisercoder/eureka/tree/master/webapp

It uses two 500-line libraries:

This 500-line lib lets you use TSX syntax without React: https://github.com/wisercoder/uibuilder

This 500-line lib implements MVC routing: https://github.com/wisercoder/mvc-router

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

#87
The real benefit of using a framework is that it helps to create components which can be easily and reliably nested. That said, nowadays you can achieve the same thing using native Web Components.

I'm currently working on a Company and Employee finder application with Web Components. I found them a lot easier to work with than React.

Also, I'm using a serverless platform I built from scratch. So it's literally all made from scratch with very few dependencies.

https://www.insnare.net/app/#/dashboard/

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

#88
The important thing in any "large" application is to set consistent patterns for doing common tasks: creating UI components, re-using them, updating their content as a result of data changes (reactivity), etc. This can be done with or without a framework.

A framework establishes a large portion of those patterns upfront. If the framework is a popular one (e.g. React) rather than an in-house one, it makes it easier to quickly ramp up hires and have a lot of documentation/examples online. Popular frameworks also implicitly contain a lot of knowledge from years of feedback from thousands of devs exercising its APIs and providing feedback, so they're typically pretty good at solving common use cases.

Obsidian was initially built by a single developer. One of the best that I have the pleasure of knowing, but when you're one person, it's much easier to create your own pattern and have it work for yourself. They have since hired maybe 2 other devs, with minimal intention of hiring more, so ease of onboarding isn't a significant concern to them the way it would be for most companies (and "large" frontend apps more often than not require larger teams, by definition).

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

#89
React is dead easy to create a component and get going with whatever you want to create. But as your application grows it is really difficult to test. The React testing library sounds good in principle, but once you have useEffects, hooks, the DOM, and every other side effect running interwoven with your component logic, it becomes difficult test. Obscenely difficult. I think there's some tradeoff operating here. I want a front end framework that makes it a little easier to test, happy to go through some more pain to write components.

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

#90
It's all about saving time. If you don't care about a particular implementation, just that it works, you're more likely a candidate for a framework. If you do care (or just want to understand how it works), then less so.

One of the biggest follies I've seen on the web is people calling themselves developers. No. You're a developer who uses a language and you prefer a specific framework written in that language. And if you don't understand that language, it really doesn't matter what framework you do or don't use—you'll be lost no matter what (or making messes that someone more qualified will have to clean up later).

All of that said: learn your language, learn the syntax, and you'll be able to pick up any framework built for it with a quick read of the docs (unless the docs suck or are non-existent, then it's best to move on to the next option).

Do the things that make you productive. All of this "best practices" crap is a farce. There is no best practice, just popular and unpopular opinions. Do what makes sense to you.

Post reply on HN