5 ms·
> keep the UI in sync with state This is absolutely true, however there are some newer tools that are appearing that make this much easer with vanilla html - h
by samwillis 4y ago
> keep the UI in sync with state
This is absolutely true, however there are some newer tools that are appearing that make this much easer with vanilla html - htmx, hyperscript, alpine.js for example (links below).
These newer tools are all made possible due to the “new”(ish) MutationObserver api, it allows you to intercept new dom elements being placed into the document. These libraries let you simple decorate your “real” html with extra attributes enabling easer client side state management. No build step required.
My hope is that a combination of these type of tools, js modules and web components will result in dropping all js build tools. With http2/3 we don’t really need bundling. In many ways it the bundling and transpiling process that has contributed the most to the friction with JS development.
My other observation would be that as js frameworks have evolved they have become more “enterprise” ready, adding tooling (complex central state management, strict typing) to make working in large teams on very large codebases easer. Much of this isn’t really necessary for the majority of we development.
https://htmx.org/ https://htmx.org/
https://hyperscript.org/ https://hyperscript.org/
https://alpinejs.dev/ https://alpinejs.dev/
- xmonkee 4y agoIt's crazy that we posted almost the exact same thing at the same time: https://news.ycombinator.com/item?id=32781674 https://news.ycombinator.com/item?id=32781674
- 9935c101ab17a66 4y agoBoth your comments are very helpful, so I’m glad you did :)
- shafyy 4y agoTo that list I'd add Hotwire (especially Stimulus: https://stimulus.hotwired.dev https://stimulus.hotwired.dev). I use with Rails, but it's framework/backend agnostic.
- symlinkk 4y agoBut if you’re going to use a framework like HTMX and the others you mentioned, why not just use React? Vanilla JS is great because it’s universally available, if you’re choosing to drop that advantage I would just go with React.
- Existenceblinks 4y agobecause `react-dom` is bloat [minified] - hyperscript@2.0.2 [3.7 kB] - htmx.org@1.8.0 [36.5 kB] - alpinejs@3.10.3 [38.1 kB] - react-dom@18.2.0 [130.5 kB] Right now my whole (everything js) really complex application is 150 kB minified. Imagine adding React .. urghh unreasonable.
- vi2837 4y agoJust try Preact
- Existenceblinks 4y agoPreact is good except it tries to be in React league. The author has greater knowledge, enough to left React behind.
- yCombLinks 4y agoWith react you need a build / transpile stage and have to handle webpack / babel / whatever. You can just use plain tags in html to use htmx and alpine, you just have to include them
- alwillis 4y agoThanks for these links! They look like the next logical step for HTML/CSS developers instead of React (or similar) which are overkill.
- potatoz2 4y agoI hope these succeed, but we still need transpilation/bundling: - TypeScript needs transpilation and it’s very popular - Bundling is still beneficial with H2/H3, if only so that compression can work well
- lenkite 4y agoPlease add https://unpoly.com/ https://unpoly.com/ to your list.