News for hackers. Stuff that matters.
Re:You might not need jQuery (2014) by cocktailpeanuts on Wednesday January 13, 2021 @09:14PM (#25770969)
What we need in 2021 is not this site, it's a youmightnotneedreact.com
Re:You might not need jQuery (2014) by inopinatus on Thursday January 14, 2021 @06:54AM (#25775308)
I've got a toolkit of pure CSS widgets I privately call "You might not need Javascript". Dropdowns, modal/lightbox, concertina, slideovers, toggles, popover, transitions, no problem.

Hacks with :checked are well known, but you can do a ton of stuff with :focus-within, :invalid, :target, :hover, <details>/<summary>/[open], grids/flexbox/visibility, and the adjacent-sibling selector. <dialog> is almost there, although it still needs a JS activation hook.

It feels really good to have a complete application UI that works with JS disabled, and I can still progressively enhance it with JS for necessary perversions of HTML like ARIA etc.

Re:You might not need jQuery (2014) by marlowe221 on Thursday January 14, 2021 @09:25AM (#25776587)
As new web developer, I would LOVE to learn how to do this kind of thing purely in CSS!
Re:You might not need jQuery (2014) by inopinatus on Friday January 15, 2021 @08:54PM (#25799150)
My process:

* trial

* error

* reading the HTML, DOM, and CSS standards documents very thoroughly end-to-end

* stackoverflow

* repeat

Re:You might not need jQuery (2014) by jjcm on Thursday January 14, 2021 @02:42AM (#25773366)
I would say that this corollary would only be possible once webcomponents have form support in all browsers. In my opinion this is the last major hurdle before there is a native alternative for reusable components in the browser. Firefox is working on it[1] but there's no current roadmap for the work for Safari (though the initial form element proposal was well received by their team).

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1552313

Re:You might not need jQuery (2014) by ratww on Thursday January 14, 2021 @06:55AM (#25775313)
I don't think it will replace React, honestly.

WebComponents can do just a fraction of what React/Vue do, and it's just the least interesting parts. The encapsulation is great, of course, but it was already possible to have "reusable components" back in the jQuery days and before.

All the WebComponents usage I've seen professionally lately were wrapping React/Vue or using some other lightweight framework that does something similar.

Not saying WCs are bad tech: just saying I think there are some great ideas in Vue/React that still don't have a native API. Would LOVE to see a new version of WebComponents adopting some of those ideas (only the good ones though haha)!

Re:You might not need jQuery (2014) by preommr on Thursday January 14, 2021 @08:40PM (#25785833)
We need a better term for front-end-js-frameworks than to keep typing react/vue, or variations of it like react/vue/angular, react/vue/svelte, react/vue/angular/svelte,
Re:You might not need jQuery (2014) by ratww on Sunday January 17, 2021 @08:09AM (#25810377)
The term is Reactive but I wanted to be more specific.
Re:You might not need jQuery (2014) by deergomoo on Thursday January 14, 2021 @03:26AM (#25773674)
The Shadow DOM spec always seemed like a good idea poorly implemented to me.

As well as the form issue, what made webcomponents untenable for me was that you can't use slots without opting the whole component into CSS encapsulation.

Great if you want to distribute components without fear of the consumer's CSS messing with your styles, absolutely useless if you want to extract common patterns in your own app because now you have to duplicate the relevant CSS in every component.

Re:You might not need jQuery (2014) by jonny383 on Wednesday January 13, 2021 @10:27PM (#25771497)
And of course in 2021 you could build the site using Vue with GraphQL and a CDN deployment pipeline with auto scaling :)
Re:You might not need jQuery (2014) by 6510 on Thursday January 14, 2021 @02:47AM (#25773404)
Build it as a single document in pure html + inline css with 20 mb of text on it and lazy loading images.
Re:You might not need jQuery (2014) by quickthrower2 on Thursday January 14, 2021 @04:15AM (#25774006)
Kubernetes, docker, nuxtjs, mongo
Re:You might not need jQuery (2014) by ritchiea on Thursday January 14, 2021 @06:44AM (#25775235)
Doesn't everyone know you don't need React? That it's a choice?

That said, I was once a single page app skeptic but I now think React and Vue are great alternatives to HTML/templates that compile to HTML if you have a reasonably complex front end. Pre-React and Vue, in the Angular.js/Ember.js/Backbone era, SPAs were not in a stage of maturity that made it simple or optimal to use them as a primary front end. Today I'd say for a complex FE go ahead with React or Vue, if you have a very simple FE, definitely consider HTML/template-to-HTML as a serious option.

Re:You might not need jQuery (2014) by adriancooney on Thursday January 14, 2021 @07:14AM (#25775475)
Even better: youmightnotneedjavascript.com

(and no, I don't mean WebAssembly - bring back static websites!)