Re:Htmx and Web Components: A Perfect Match
by williamcotton on Thursday January 18, 2024 @12:30PM
(#39044656)
A global store isn’t necessarily a bad thing… in a functional language!
Re:Htmx and Web Components: A Perfect Match
by bobthepanda on Thursday January 18, 2024 @10:57AM
(#39043326)
Redux, and later useContext, were invented specifically to eliminate prop drilling.
Re:Htmx and Web Components: A Perfect Match
by williamcotton on Thursday January 18, 2024 @12:27PM
(#39044613)
Prop drilling wouldn’t be an issue in a functional language as partial application could solve this problem.
I think a lot of the issues with React in general has to do with attempting to contort JS into a functional language.
useContext can lead to some gnarly code.
Re:Htmx and Web Components: A Perfect Match
by bobthepanda on Thursday January 18, 2024 @12:46PM
(#39044878)
The major issue, IMO, is that the DOM is just markup with an API grafted on, and so any framework attempting to add the slightest bit of composability or state management has to twist and turn itself to be compatible in all browsers.
And that's how we got here, because everyone wants to make their applications available on as many platforms as possible, without having to maintain five or six separate teams that have to coordinate a roadmap, and the browser is the only somewhat consistent way to do this.
Re:Htmx and Web Components: A Perfect Match
by simonbarker87 on Thursday January 18, 2024 @01:18PM
(#39045370)
> contort JS into a functional language
I made something last year in a functional style as I was fresh off the back of a few React jobs and projects. I got a proof of concept working but the code was awful to work with.
I took a couple of days to start over and rewrite it with OOP principles and it was in a much better state afterwards.
Re:Htmx and Web Components: A Perfect Match
by j-krieger on Friday January 19, 2024 @05:34AM
(#39053861)
This is untrue. You can observe this in scalas implicits, which generate an insane mess in any medium to large codebase.
Re:Htmx and Web Components: A Perfect Match
by wmfiv on Thursday January 18, 2024 @01:25PM
(#39045513)
Right. And I think the point is that Redux is a godsend for some small percentage of products but for the vast majority the cure is worse than the disease. Simple and slightly verbose is just "better" as a general solution than the powerful but complex solutions you get with Redux.
The thought behind this is that components live in pyramids, and state and props ideally only go down and rarely up by setters-> parents and their immediate children can easily share state and props.
This gets more complicated the larger your family line gets. Many grandchildren down, you have since passed the respective props via prop drilling through a lot of components that perhaps don't care for them. It also gets complicated if you want to share state not in an immediate family line, but in a neighborhood.
Overdoing it is almost like hoarding. You think "eh, maybe I need this later somewhere else) and suddenly, your entire application basically lives in the global store.