Most active commenters
  • thunky(7)
  • lmm(5)
  • pier25(4)
  • klysm(3)

←back to thread

262 points gherkinnn | 25 comments | | HN request time: 3.587s | source | bottom
Show context
pier25 ◴[] No.42164501[source]
> I like to argue that some of the most productive days of the web were the PHP and JQuery spaghetti days

I've wondered if going back to that paradigm would be more productive or not than using React et al.

Plenty of big sites like Amazon or Steam still are made this way. Not exactly PHP + jQuery but rendering HTML on the server and sprinkling some JS on top of it.

Has anyone gone back to working like that?

replies(13): >>42164565 #>>42164636 #>>42164646 #>>42164666 #>>42164714 #>>42164722 #>>42164754 #>>42164840 #>>42164957 #>>42165180 #>>42166069 #>>42169495 #>>42169508 #
1. scrollaway ◴[] No.42164840[source]
It’s really not more productive.

Working with react has a higher barrier of entry (something which is becoming less true over time given that many templates etc exist for it), but if you want to be producing pages and functionality, a good react dev will run leagues around even an a exceptionally good jquery dev.

I’m solid at both and we are talking a dev cycle that is magnitudes faster once you are set up reasonably well. There’s a reason it’s popular. Typescript makes a lot of testing unnecessary and gives many guarantees on robustness. React makes it a breeze to create complex state full components. Nextjs makes it super easy to deploy all this to a web app and quickly create new pages.

replies(2): >>42164893 #>>42164963 #
2. pier25 ◴[] No.42164893[source]
> a good react dev will run leagues around even an a exceptionally good jquery dev

It probably depends on the use case, no?

If you only need links, forms, and data tables what advantage does React have over SSR + jQuery?

replies(2): >>42164987 #>>42166351 #
3. swatcoder ◴[] No.42164963[source]
For as much as you're right, your taking a very narrow short-term view of productivity.

The maintenance demands for using a heavy, evolving framework and a large graph of churning dependencies are tremendous and perpetual. While you can make meaningful wins on delivery time for a new feature, once "you are set up reasonably well", you've impliclty introduced new costs that don't apply to "vanilla" code that stays closer to established standards and only includes code it actually uses.

That's not to argue that vanilla is strictly better (both have a place), but just to acknowledge a latent but significant tradeoff that your comment seems to ignore.

replies(3): >>42165266 #>>42166551 #>>42171907 #
4. morbicer ◴[] No.42164987[source]
Non-spaghetti dynamic forms and their validation (yes you need to validate on server as well).

Reusable components that can be tested in isolation. Type support. That leads to easier evolution and refactoring.

With good architecture you can go mobile with react-native.

replies(1): >>42165121 #
5. pier25 ◴[] No.42165121{3}[source]
Most modern backend frameworks provide components, types, and validation.

Laravel, Dotnet, Rails, etc.

6. pier25 ◴[] No.42165266[source]
> and a large graph of churning dependencies are tremendous and perpetual

Absolutely. This the reason I'm moving on from JS in the backend. You're constantly stitching up dependencies which might be abandoned and/or become incompatible at any moment.

7. klysm ◴[] No.42166351[source]
Composabilty and abstraction. I can bang out a react form in our app in minutes just by defining the shape of the fields. All the loading states are handled automatically. Mutations and refreshing data works out of the box. Navigating between pages is instant. Data is cached even when navigating between pages. Some pages that require many user inputs utilize optimistic updates to afford very low latency feedback.

React makes all of that easy to compose. I tell it how to render my state, and I write code that updates state.

replies(2): >>42168427 #>>42170630 #
8. whstl ◴[] No.42166551[source]
> The maintenance demands for using a heavy, evolving framework and a large graph of churning dependencies are tremendous and perpetual

Counterpoint: If you replace a frontend framework with backend components, as has been suggested a few times in this thread, those frameworks are even larger, and a lot of the basic functionality provided by React (such as components) is often provided by third-party packages.

Sure, if you're using something like jQuery, then it's smaller and more stable, but the functionality is limited compared to both backend and frontend frameworks. Which of course might be 100% appropriate depending on the use case.

9. thunky ◴[] No.42168427{3}[source]
> Composabilty and abstraction

Also possible without react with far less complexity.

replies(2): >>42168835 #>>42169115 #
10. lmm ◴[] No.42168835{4}[source]
It really isn't, unless you go full server-side session (with something like Wicket), and the latency of that is usually unacceptable these days.
replies(1): >>42172139 #
11. klysm ◴[] No.42169115{4}[source]
I’ll believe it when I see it. I’ve used many many different UI frameworks, and react works the best out of all of them that I’ve tried.
12. Zanfa ◴[] No.42170630{3}[source]
On the other hand, using React means you'll have a 2nd source of state (form & navigation at the very least) that needs to be maintained and tested for edge cases. Everything needs to be validated 2x, since you can't trust anything coming from a client anyway. Correct state management between page navigations is definitely not something you get for free judging from the number of broken React SPAs where you can't properly use multiple tabs or other browser mechanisms.
replies(1): >>42179951 #
13. imtringued ◴[] No.42171907[source]
I'm still working on a project that uses jQuery in 2024 and it is a horribly bad fit and maintenance nightmare. I would prefer predictable new costs over random global effects in combination with duplicated server-side and client-side code that can blow up at any time.
14. thunky ◴[] No.42172139{5}[source]
I think you and the sibling may have missed the requirements up thread:

If you only need links, forms, and data tables

replies(1): >>42178685 #
15. lmm ◴[] No.42178685{6}[source]
In my experience even something you thought was a basic form will usually have some kind of UI state (e.g. one input that then enables/disables another input).
replies(1): >>42179626 #
16. thunky ◴[] No.42179626{7}[source]
Can't that be done in one or two lines of jQuery?
replies(1): >>42179903 #
17. lmm ◴[] No.42179903{8}[source]
Yes, of course. And then you add one or two more lines of jQuery. And then another few lines to deal with the client-side and server-side state getting out of sync. And then...

Is putting in a couple of lines of JS that has no knowledge of the backend-managed good enough for small one-off pages? Maybe. But it's definitely not composable and abstractable, which was the original claim.

replies(1): >>42183510 #
18. klysm ◴[] No.42179951{4}[source]
The libraries I use give it to me for free
19. thunky ◴[] No.42183510{9}[source]
I assume we're still talking about links, forms, and data tables. If the forms are so complex that we need React to manage them then it may be worth trying to simplify them a bit first.

Or if the forms have to sync with the backend then there are other React-less options, for example:

https://htmx.org/examples/value-select/

replies(1): >>42189602 #
20. lmm ◴[] No.42189602{10}[source]
> If the forms are so complex that we need React to manage them then it may be worth trying to simplify them a bit first.

Some forms are simple enough that you don't need composition and abstraction, yes, no-one's denying that.

> Or if the forms have to sync with the backend then there are other React-less options, for example:

> https://htmx.org/examples/value-select/

Ok, now try composing that. What happens when you want to nest one of those inside another (i.e. have 3 levels of selection)?

replies(1): >>42193954 #
21. thunky ◴[] No.42193954{11}[source]
The forms/inputs are composable on the backend where the state is managed and the html is produced.

Here's the most dynamic form I can think of: https://www.globalgolf.com/golf-clubs/1064148-titleist-tsr2-...

Any input change triggers any/all other inputs to change.

Looks like they send the entire page each action, no React, yet the user experience is much better than the typical competitor site where they've overengineered the whole front end.

Their faceted search is nice too: https://www.globalgolf.com/golf-clubs/used/titleist/fairway-...

Notice how when you add a filter it updates the URL. Breath of fresh air.

And this is way beyond what I had in mind when I read links, forms, and data tables.

replies(1): >>42199963 #
22. lmm ◴[] No.42199963{12}[source]
I clicked a couple of inputs and it's now stuck on a loading animation of a glass getting filled with golf balls (been running for about two minutes now). So you've pretty much proven my point.
replies(1): >>42200535 #
23. thunky ◴[] No.42200535{13}[source]
Oh no...

Welp guess I'll have to take my business elsewhere. Thanks for the heads up.

Now I'm off to find a golf site that uses React for guaranteed perfection.

replies(1): >>42209437 #
24. scrollaway ◴[] No.42209437{14}[source]
As a third party to this conversation, I think it's completely hilarious that you try really hard to make a point that ends up proven wrong, and your answer, rather than actual introspection about your beliefs, is sarcasm and an overall rude response.

This stubbornly stupid mindset is why we have wars.

Edit: I checked the site myself and was able to reproduce the issue mentioned in GP. This is a terrible website.

replies(1): >>42236526 #
25. thunky ◴[] No.42236526{15}[source]
> you try really hard to make a point that ends up proven wrong

I really don't think the argument for or against React has been settled.

GP focused their mic drop on my example rather than the larger conversation, which missed the point. You're doing the same thing now.

Feel free to add something to the conversation.