News for hackers. Stuff that matters.
Re:Bootstrap 5 alpha by SkyBelow on Tuesday June 16, 2020 @05:39PM (#23544552)
I wonder if I can get more web developers where I work back in the bootstrap camp now. Use of jQuery was their main complaint and reason for abandoning.

On a related note, I feel like I'm officially becoming an old fogy because I learned web development with jQuery but never did enough to experience the pains it brings that newer frameworks do away with, and as such I still feel drawn to using jQuery, especially when I want to throw together a smaller websites.

Re:Bootstrap 5 alpha by andybak on Tuesday June 16, 2020 @06:02PM (#23544823)
I did my last small project with vanilla js and the ugliness of the native APIs reminded my how lovely jQuery is.

Do the maths - if the file size isn't a problem then go for it. Life's too short to be the victim of fashion.

Re:Bootstrap 5 alpha by jka on Tuesday June 16, 2020 @06:13PM (#23544933)
Although jQuery does seem less popular as a choice for new projects nowadays, I'd like to chime in to agree here (not to knock Bootstrap; it's good that they're staying current with their developer ecosystem).

Given appropriate element names and classes, jQuery and CSS selectors can provide a straightforward and readable way to express application behaviours, and it's a well-proven and stable project at this point.

Re:Bootstrap 5 alpha by CryoLogic on Tuesday June 16, 2020 @06:30PM (#23545091)
There is very little functionality JQuery offers that the modern browser DOM API doesn't provide with more robust performance.
Re:Bootstrap 5 alpha by JeremyNT on Tuesday June 16, 2020 @07:19PM (#23545538)
Yeah, this is what some commenters are missing. The real alternative to jQuery isn't some fancy new framework, it's just... plain JavaScript.

Things have really gotten much better in the vanilla world. Although some things remain more verbose or cumbersome than jQuery alternatives, you really don't need a whole layer of abstraction to handle the simple tasks jQuery was designed for any more.

Unless, of course, you care about IE...

Re:Bootstrap 5 alpha by andybak on Tuesday June 16, 2020 @06:55PM (#23545329)
jQuery somehow gets abuse for being more bloated and slower than vanilla js despite the fact that almost nobody is ditching jQuery for vanilla js and instead running to vastly slower and more bloated SPA frameworks.
Re:Bootstrap 5 alpha by corobo on Tuesday June 16, 2020 @08:40PM (#23546269)
Did this comment onwards miss

"I did my last small project with vanilla js and the ugliness of the native APIs reminded my how lovely jQuery is" or am I seeing wonky here

Re:Bootstrap 5 alpha by jfkebwjsbx on Tuesday June 16, 2020 @06:37PM (#23545157)
Yes, but the native APIs are a PITA.
Re:Bootstrap 5 alpha by rorykoehler on Wednesday June 17, 2020 @03:22AM (#23548752)
At they? I don't write much js but always found the native apis to be the quickest way to implement functionality when I need to
Re:Bootstrap 5 alpha by The_Colonel on Wednesday June 17, 2020 @03:40AM (#23548861)
Yes, nearly every native API is uglier/longer/more inconsistent than jQuery equivalent.
Re:Bootstrap 5 alpha by chrisweekly on Tuesday June 16, 2020 @07:02PM (#23545408)
not like they used to be, youngster*

* veteran of the original browser wars

Re:Bootstrap 5 alpha by Widdershin on Tuesday June 16, 2020 @08:12PM (#23546020)
So is jQuery imo, especially the nonsensical argument order for iteration.
Re:Bootstrap 5 alpha by systematical on Tuesday June 16, 2020 @11:03PM (#23547271)
HackerNews is back on this debate I see. Look, I still use jQuery, mostly because I comfortable with it. If I am doing a small side project or an MVP that doesn't need heavy JavaScript then why would I configure all that JavaScript tooling when I can just use something I am comfortable with? I hear, but jQuery is heavy. I wonder if any tests have been done to see how much that ACTUALLY matters. Is the difference between react and jquery file size that much? And does it actually matter? I don't think most people who drop the "its bigger" argument know the size differences, let a lone the impact. It's just a nice trope nowadays. But please link to something to educate me.

With that said, I do use the modern vanilla js api from time to time. It's gotten better. There are still some things that aren't great, but it's fine. I use it a lot when working in puppeteer actually.

But back to jQUery. If I need to add some interactivity to a site and I know some jQuery plugins. I just use that. I did it for an entire MVP just recently. I know if it takes off all that frontend work I did will be replaced. Great, jQuery (but mostly just plain old school web dev) got me there without the need for an over-engineered tooling ecosystem. I've watched people struggle with slick new shit on MVPs before. I'm already iterating on my product and testing new hypothesis.

If you are more comfortable with the newer stuff then you should use that. If you are more comfortable with jQuery you should use that. If the product you are developing specifically needs or doesn't need one, then go with what the product needs.

Edit: Also this about BootStrap. I love it, also makes my life easy for MVPs and backends. Keep going strong bootstrap!

Re:Bootstrap 5 alpha by TheKarateKid on Friday June 19, 2020 @11:16AM (#23575316)
Amen!! It reminds me of the people who used to talk down on devs who use Java, C#, Python, and basically any language that isn’t C++ “because it’s more efficient” and all the others are “terrible and bloated.”
Re:Bootstrap 5 alpha by democracy on Wednesday June 17, 2020 @09:39AM (#23551221)
Second that, I am also in this stage of life where having a good sleep is more important than having a pure code. Some annoying platform-specific bug is not fun any more, especially if it was solved many years ago by someone else, so yay to jquery!
Re:Bootstrap 5 alpha by noble_pleb on Wednesday June 17, 2020 @02:48AM (#23548517)
Seconded. $(document).ready(fn) is far more easier and comprehensible than document.addEventListener('DOMContentLoaded', fn, false).

Even if I'm aware of the latter, I refuse to use it when former is available just for the sake of being "PureJS trendy".

Re:Bootstrap 5 alpha by ericwood on Tuesday June 16, 2020 @06:13PM (#23544941)
It's not so much the pain it brings, so much as the fact that a lot of the original inconsistencies and querying it was invented for are either gone or integrated fully into the native APIs. http://youmightnotneedjquery.com/ illustrates this fairly well! After working with more modern JS and the pure browser APIs on larger non-trivial projects I can't say I've ever felt the need to reach for jQuery the way I used to in its heyday.

I'd be hesitant to refer to jQuery as a framework, as I don't think it fills the same void as what we commonly think of as a "javascript framework" does; it was more a utility for querying and mutating the DOM. It doesn't provide answers for questions like "how do I handle state?" or "how do I convert state into DOM?", although it does give you some tools to answer those questions yourself.

Re:Bootstrap 5 alpha by methodin on Tuesday June 16, 2020 @06:50PM (#23545285)
Agreed. I think people do tend to forget jQuery's primary use and greatness came from masking browser inconsistencies and exposing things that just weren't even possible with vanilla JS. Necessity for that type of thing has waned but someone coming into jQuery now or in the last couple years I could see the disdain if they weren't around when making your JS work in all browsers was ridiculously hard and time-consuming. It was a very, very good and useful segue tool that has run its course.
Re:Bootstrap 5 alpha by atorodius on Tuesday June 16, 2020 @06:06PM (#23544864)
I‘m new to frontent development. I had a lot of fun with jQuery so I‘m wondering: What‘s the problem with it? Do people now ise vanilla JS?
Re:Bootstrap 5 alpha by irrational on Tuesday June 16, 2020 @06:14PM (#23544946)
If you are using a framework/library like React, Vue, Angular, etc. then the need for jQuery goes away.

However, the number of websites where a full-blown library like React is the right tech stack is probably less than 5%. For everyone else you would want to use vanilla JS, though if you are already familiar with jQuery I don't think there is anything wrong with using it.

The funny thing is I spent years using jQuery and have also used Vue.js, but I'm just so tired have having to deal with importing libraries, setting up build systems, etc. that 9 times out of 10 I will just use vanilla HTML/CSS/JS and call it a day. It is just so much simpler. YMMV

Re:Bootstrap 5 alpha by c1b on Tuesday June 16, 2020 @06:34PM (#23545127)
In which situations is React unsuitable? I learned web development starting with React and have been using it for everything since.
Re:Bootstrap 5 alpha by jfkebwjsbx on Tuesday June 16, 2020 @06:39PM (#23545175)
React is meant to simplify application development, specially suited for single-page apps (SPAs).

For a normal/small website, there is no need for a framework like that which adds unneeded complexity.

Re:Bootstrap 5 alpha by brmgb on Tuesday June 16, 2020 @07:51PM (#23545807)
I don't know. Being neither a web developer nor a frontend specialist (my professional development days are long behind me and were mostly spent on real time systems in Ada with some UI work using Qt), I recently developed a small site using react and redux. I chose the stack for fun but I found the experience a lot nicer than all my previous forays into web development. It felt a lot cleaner than what I was expecting. I think the stack pushes you in a clear direction regarding architecture and to me it seemed to make things simpler rather than more complicated.
Re:Bootstrap 5 alpha by arcturus17 on Wednesday June 17, 2020 @02:43AM (#23548483)
That’s exactly why many of us use it, without giving much thought to the idea that it’s heavy or slow (which really makes me wonder what the hell some people are doing with their React apps...)

The developer ergonomics, and the mental models which it prescribes - which are why I’d argue it’s actually a framework and not just a library, but that’s semantics - are really well thought out and can make you very productive.

If I want to build a static site with minimal fuss I might still use something like HTML, Sass and vanilla JS with Parcel. For pretty much everything else React has become a default.

Re:Bootstrap 5 alpha by baddox on Tuesday June 16, 2020 @07:27PM (#23545603)
React is also well-suited for a single highly-interactive module on an otherwise non-React website. Of course, you still need to consider JS code size and loading performance, but it would often be completely reasonable to use React for, say, a very complex interactive form or table of data on your otherwise static Rails website.
Re:Bootstrap 5 alpha by BigJono on Tuesday June 16, 2020 @10:15PM (#23546976)
Something like Preact can be pretty good for this too. The one thing that makes React (by itself, not with all the stupid extras) good for this stuff (as opposed to Vue and Angular) is that it has a very simple API without much surface area, so it's relatively easy to maintain, just like jQuery. But where it still falls a bit short is the actual size of the library itself, it's a bit wasteful to package in React just for a widget or something.
Re:Bootstrap 5 alpha by sk0v on Wednesday June 17, 2020 @05:11AM (#23549381)
I don't agree at all. React is just as much a framework as a "way of thinking". I use react for _everything_ - because it's a great way to whip out a website - large or small. The "complexity" added is non-existent, unless it's because you are not willing to learn the way to do things. That's not the paradigm's fault, that's just people being complacent and lazy - sticking with "what they know" (which is fine, it's human nature).

Throwing together an API in .NET Core and a website consuming that API in React takes less than 5 minutes to get going.

Re:Bootstrap 5 alpha by donum on Wednesday June 17, 2020 @06:09AM (#23549721)
Did you ever have to optimize for SEA/SEO/Page speed?
Re:Bootstrap 5 alpha by mrastro on Tuesday June 16, 2020 @06:44PM (#23545216)
Any app that requires lots of direct DOM manipulation (which are pretty rare cases).

Think making use of html `canvas`. Though there are nice libraries that abstract the ugliness like react-canvas, it would lead to less reusable code than the jQuery equivalent, imo.

Re:Bootstrap 5 alpha by WillPostForFood on Tuesday June 16, 2020 @07:41PM (#23545725)
Hacker News, reddit, any blog, any newspaper.
Re:Bootstrap 5 alpha by xike on Tuesday June 16, 2020 @09:09PM (#23546501)
You got to be kidding, HK? Newspaper? i rather choose SSR and got more SEO friendly than interactive components on screen for what? Newspaper?
Re:Bootstrap 5 alpha by WillPostForFood on Monday June 22, 2020 @05:30PM (#23606965)
Late reply, but yes, I totally agree. I was giving example of things that shouldn't use React. Everything should be SSR, and no in page interactivity at all is needed.
Re:Bootstrap 5 alpha by scrollaway on Tuesday June 16, 2020 @06:09PM (#23544895)
It's an unnecessary dependency for those using different frameworks. Its imperative model is also very incompatible with the reactive model that's becoming more common in frontend (React etc).
Re:Bootstrap 5 alpha by rtsil on Tuesday June 16, 2020 @09:36PM (#23546716)
There's no problem with it, but its 2 main use cases are gone: ensuring a consistent idiom between various browsers, and providing a nicer API. Vanilla js does both now (if you really want to support older non-IE browsers, you can add a transpiling step).

There's one use case that might remain: the jquery plugins ecosystem. You can find many replacements on npm, but they're a bit less beginner-friendly.

Re:Bootstrap 5 alpha by ReptileMan on Tuesday June 16, 2020 @06:06PM (#23544871)
What is the problem with jquery exactly? What is a person that hates the reactive frameworks with a passion to use nowadays?
Re:Bootstrap 5 alpha by scrollaway on Tuesday June 16, 2020 @06:09PM (#23544903)
Just because they dropped the jquery dependency doesn't mean you can't use jquery anymore.
Re:Bootstrap 5 alpha by ReptileMan on Wednesday June 17, 2020 @07:11AM (#23550068)
I use jquery. But I don't get what the fundamental problem with it is to be needed to be dropped. Or its use to be frowned upon
Re:Bootstrap 5 alpha by SlackingOff123 on Wednesday June 17, 2020 @10:50AM (#23552102)
If you develop an Angular/Vue SPA you may want to use Bootstrap for styling but have no need for jQuery.
Re:Bootstrap 5 alpha by memexy on Tuesday June 16, 2020 @06:09PM (#23544891)
What is wrong with reactive frameworks?
Re:Bootstrap 5 alpha by freehunter on Tuesday June 16, 2020 @09:31PM (#23546672)
I dislike having to write a separate front-end and back-end and worry about APIs and JWTs and security and Redux and multiple servers coupled with isomorphic React being more pain than it's worth when I could just as easily not use React.

I'd use React on every project if I could run it like a Rails front-end instead of needing to write distinct server and client side applications.

Re:Bootstrap 5 alpha by terandle on Tuesday June 16, 2020 @09:46PM (#23546781)
Have you looked at next.js? It allows you to write your server side database access code/etc in the same place as your react client side app. Pretty neat, however I personally would rather write my backend code in something better than JS so I don't go that route.
Re:Bootstrap 5 alpha by memexy on Tuesday June 16, 2020 @10:16PM (#23546980)
Not sure I follow. Reactive frameworks includes more than React. Reactive frameworks generally mean some form of observables, observers, and mechanisms for linking the two together via a dataflow graph, e.g. http://reactivex.io/documentation/observable.html.

> This page explains what the reactive pattern is and what Observables and observers are (and how observers subscribe to Observables). Other pages show how you use the variety of Observable operators to link Observables together and change their behaviors.

I'm not familiar with React so I'm not sure how all these concepts are implemented in React.

Re:Bootstrap 5 alpha by c17r on Tuesday June 16, 2020 @11:04PM (#23547277)
Look into InertiaJS. Svelte/Vue/React become just the UI piece and everything else (routing, validation, etc) is handled server side
Re:Bootstrap 5 alpha by mmgutz on Wednesday June 17, 2020 @03:12AM (#23548672)
Most front end folks that I've spoken with didn't like the jQuery dependency not because it was huge or old but because jQuery does not play nice in a component world (React, Angular, Vue ...). Bootstrap 5's custom Javascript solution will unlikely change their view.

With that said, there's a lot to like in Bootstrap 5 to quickly throw together a site.

Re:Bootstrap 5 alpha by ma2rten on Tuesday June 16, 2020 @06:11PM (#23544920)
jQuery solved the problem of browser compatibility and hard-to-use browser APIs. However browser api have improved a lot, with new apis sometimes modeled after jquery, and browser compatibility is much less of an issue. There is really isn't a reason to use jQuery over just vanilla javascript anymore.

I don't think it makes sense to use React and friends unless you are building Single Page Applications.

Re:Bootstrap 5 alpha by ravenstine on Tuesday June 16, 2020 @06:37PM (#23545160)
That was one of the biggest reasons I abandoned it.

But also, since Bootstrap, a lot of competition in that space has popped up, and there's less of a need to buy in to everything that Bootstrap comes with, or any particular frontend library for that matter.

These days, I don't know if I would use Bootstrap again unless there were parts I wanted to harvest from it.

Re:Bootstrap 5 alpha by jasonhansel on Tuesday June 16, 2020 @05:52PM (#23544714)
jQuery does still have a place for smaller websites IMHO. I really wish Intercooler (http://intercoolerjs.org/) had caught on more for such uses.
Re:Bootstrap 5 alpha by pcardoso on Tuesday June 16, 2020 @06:20PM (#23545006)
The author of Intercooler has a new project

https://htmx.org

Re:Bootstrap 5 alpha by brylie on Tuesday June 16, 2020 @06:36PM (#23545143)
Dang. The documentation links don't seem to work on Firefox Mobile.
Re:Bootstrap 5 alpha by DangitBobby on Tuesday June 16, 2020 @07:09PM (#23545460)
That's strange. They work for me on Firefox Preview
Re:Bootstrap 5 alpha by tapvt on Tuesday June 16, 2020 @10:17PM (#23546986)
I’m very excited to find this. I have a handful of projects in my pipeline that require “just enough” of the dynamic sugar that this could potentially provide for little investment of time.
Re:Bootstrap 5 alpha by xellisx on Tuesday June 16, 2020 @06:13PM (#23544931)
There is also Cash JS.
Re:Bootstrap 5 alpha by rorykoehler on Wednesday June 17, 2020 @03:19AM (#23548723)
I have found that vanilla js is now cleaner than jquery for all my use cases.