News for hackers. Stuff that matters.
Re:Things you forgot because of React by mft_ on Tuesday August 15, 2023 @06:48AM (#37132309)
So in mid-2023, if not React, what would HN choose?
Re:Things you forgot because of React by pweissbrod on Tuesday August 15, 2023 @07:35AM (#37132657)
I'm curious if anyone else is advocating for HTMX as a mechanism to simplify bloated front end code bases
Re:Things you forgot because of React by erikcw on Tuesday August 15, 2023 @11:11AM (#37134948)
I’ve been using it to great effect for the last year or so. It really is a breath of fresh air. In my case, I’m using a Django backend, but there are lots of successful folks using other backend stacks as well so choose what you know best.

The book is a really quick and easy read. It’s pretty eye opening how productive, and effective, htmx can be with so little magic.

https://hypermedia.systems/

Re:Things you forgot because of React by kmlx on Tuesday August 15, 2023 @06:51AM (#37132330)
for a small project i would choose vanilla. vanilla is good enough today, tons of features supported on all the browsers, etc etc

but for a large project still react.

Re:Things you forgot because of React by tehbeard on Tuesday August 15, 2023 @08:11AM (#37132984)
ehhhh. I'd think maybe lit-element if you're going to be leaning on Web Components to smooth some of the edges of "vanilla".
Re:Things you forgot because of React by tjpnz on Tuesday August 15, 2023 @07:23AM (#37132558)
If it's an internal app, server rendered HTML and maybe a JS library to render charts. Django or Rails both fit the bill.
Re:Things you forgot because of React by vallanceroad on Tuesday August 15, 2023 @07:45AM (#37132737)
Genuine question from someone who's only worked in CSS-in-JS or SCSS preprocessors for the past ten years -- what would you choose for styling?
Re:Things you forgot because of React by dham on Tuesday August 15, 2023 @08:35AM (#37133199)
CSS? In all seriousness though Tailwind or SCSS.
Re:Things you forgot because of React by tjpnz on Tuesday August 15, 2023 @08:53AM (#37133358)
Plain old CSS.
Re:Things you forgot because of React by ed_ on Tuesday August 15, 2023 @07:16AM (#37132507)
Mithril.js, for both work and personal projects. There hasn't been a major release since I started using it ~4 years ago, which is lovely in the otherwise churning sea of frontend development.
Re:Things you forgot because of React by hasanhaja on Tuesday August 15, 2023 @07:23AM (#37132553)
Solid as a React alternative, and Astro as a Next.js alternative. SolidStart is pretty cool, but I like the flexibility of Astro
Re:Things you forgot because of React by pjmlp on Tuesday August 15, 2023 @07:04AM (#37132432)
At work, whatever the FE team decides upon, React/Nextjs, Angular and Vue are the only relevant ones.

Privately, I always go with vanilajs.

Re:Things you forgot because of React by mhoad on Tuesday August 15, 2023 @07:01AM (#37132413)
Lit.dev has been nothing but great for me. Strong recommendation.
Re:Things you forgot because of React by reustle on Tuesday August 15, 2023 @08:03AM (#37132893)
I used on a project 6~mo ago and struggled quite a bit to get some basic things to work. Iirc it was related to event handling on nested elements in a component. I believe I felt quite forced to make lots of very tiny components, which made the "try it out" phase quite frustrating.

Do you have any recommended learning resources on building with Lit?

Re:Things you forgot because of React by em-bee on Tuesday August 15, 2023 @07:48AM (#37132763)
i like aurelia because it has a minimal footprint on my code.

i set up routing with the views available and i write a class for each view. there is practically no boilderplate code. (eg what is $scope in angular is simply the class object itself in aurelia)

any class level function and variable is automatically made accessible from the html template. classes and templates are linked by sharing the same name: welcome.html, welcome.js, export class Welcome ...

while in angular you have to declare everything explicitly, aurelia mostly just figures it out by itself.

Re:Things you forgot because of React by seabass-labrax on Tuesday August 15, 2023 @08:04AM (#37132910)
I'm seriously looking into Preact[1] as a library which is philosophically aligned with React, fits in nicely with the rest of the JavaScript ecosystem, but has a very small footprint for what it provides (3KiB).

[1]: https://preactjs.com/

Re:Things you forgot because of React by tehbeard on Tuesday August 15, 2023 @08:13AM (#37133003)
Maybe it's changed with more recent version but that small footprint was a trap for us. We picked it for that, and ran into weird edge cases / bugs in preact projects using third party libs that didn't occur with react.
Re:Things you forgot because of React by seabass-labrax on Tuesday August 15, 2023 @09:03AM (#37133469)
Thanks for the warning, although in my case I'm not planning to use any third-party libraries except maybe some fundamental ones like Hammer. :)
Re:Things you forgot because of React by shmde on Tuesday August 15, 2023 @08:05AM (#37132925)
Some niche ass framework with little to no eco-system. Or plain javascript by people thinking the web is used to display a single page worth of content.
Re:Things you forgot because of React by pie_flavor on Tuesday August 15, 2023 @08:34AM (#37133189)
If you don't already have a backend framework, I see no reason to disagree with TFA's recommendation of Svelte/SvelteKit[0]. It's simple, there's no runtime framework magic to debug, everything works exactly like you assume it does, it's pretty darn fast, and the DSL syntax isn't easily confused for the HTML it's templating (looking at you, Vue).

If you do have a backend framework, then having the backend drive the dynamic updating is a pretty great way to go, so HTMX[1] is the least obtuse way of putting the most power in the hands of the backend. Really makes 'a light sprinkling of JS for interactivity' closer to reality than vanilla JS allows, without adding cognitive overhead.

[0]: https://svelte.dev/ [1]: https://htmx.org/

Re:Things you forgot because of React by masterofmisc on Tuesday August 15, 2023 @09:08AM (#37133535)
Ehhh. React of course! Well, for me anyway.
Re:Things you forgot because of React by tored on Tuesday August 15, 2023 @09:12AM (#37133565)
PHP with server side rendered templates.
Re:Things you forgot because of React by mcv on Tuesday August 15, 2023 @09:34AM (#37133813)
If I had to choose a frontend framework right now, I'd probably go with Svelte. That was my opinion before I read this article, and this article confirms it.
Re:Things you forgot because of React by dahwolf on Tuesday August 15, 2023 @10:26AM (#37134401)
Not sure, the typical HN user has JS disabled.