r/webdev • • Feb 13 '19

Bootstrap 5 will remove jQuery as a dependency

https://github.com/twbs/bootstrap/pull/23586
1.5k Upvotes

398 comments sorted by

View all comments

Show parent comments

8

u/timeshifter_ Feb 13 '19

Sounds like somebody doesn't understand that jQuery is just a tool, a very useful tool, for doing something that you are inevitably going to be doing a lot of while using Bootstrap.

15

u/Earhacker JavaScript Feb 13 '19

Sounds like somebody doesn’t understand that React is just a tool, a very powerful tool, for making DOM manipulation more efficient by making changes to a virtual DOM, then using a very efficient diffing algorithm to determine whether or not changes need to be made to the actual DOM. If jQuery (or vanilla or another library) is making changes to the real DOM at the same time, then the diffing algorithm is goosed.

Using jQuery on React components isn’t just shooting yourself in the foot, it’s shooting yourself in the gut and bleeding to death in agonising pain. That’s why Bootstrap has lost ground to things like Bulma and Semantic UI that are pure CSS (or pure Sass or whatever).

But it’ll be good to have Bootstrap back, like getting to work with an old friend again.

1

u/gijovarghese Feb 13 '19

Most of this stuff can be done easily via React. I don't want to bloat my apps by including JQuery

6

u/timeshifter_ Feb 13 '19

750KB vs 86KB.

And you claim to be worried about bloat.

11

u/spryes Feb 13 '19

750 KB? Where'd you get that from?

React + ReactDOM is ~35 kB minzipped and jQuery slim is ~24 kB minzipped.

It's recommended that first load JS does not exceed about 150 kB minzipped (parsing/compiling is especially expensive on slow devices), adding a jQuery dependency is pretty annoying.

-11

u/[deleted] Feb 13 '19

create-react-app is around 250MB, oh wait did I learn the wrong react?

5

u/spryes Feb 13 '19

Uhh yes you did, if you think a development build tool setup is the same as React's production size shipped to users

→ More replies (1)

1

u/gijovarghese Feb 13 '19

"somebody doesn't understand that jQuery". I know there are many 'somebody' on Facebook to understand what's the difference b/w JQuery and React.

-3

u/gijovarghese Feb 13 '19

I've to use that 750KB anyway. Why should I add another 86KB?

-6

u/timeshifter_ Feb 13 '19

And that's just the react-dom library.

Just sayin'. You can't really complain about bloat when your chosen DOM library is 9x the size of the one you're complaining about.

13

u/spryes Feb 13 '19

750 KB is the unminified development version of react-dom. The version users actually download is about 33 kB over the wire. It's completely disingenuous because users don't download that version on a production website. It has tons of source comments and warnings useful for development which makes it so large.

-4

u/lovestheasianladies Feb 13 '19

...and the size of jQuery is insanely small for the gzipped version too.

What's your point?

5

u/spryes Feb 13 '19

Point 1: He was being dishonest about the size of React (9x bigger? It's around 1.45x actually)

Point 2: Size-conscious devs have a hard time including a fairly large dependency that they don't directly use, it feels like a waste

Point 3: It takes up 16% of the initial payload size budget and takes up 50ms of parse/compile time on slow CPUs when it doesn't need to (all of Bootstrap's JS can be written with the plain DOM API with equal browser support, there's no need to use jQuery in 2019)

2

u/rackmountrambo full-stack Feb 13 '19

Also size conscious devs generally build the resources with webpack eliminating many unused facets of the library.

1

u/noknockers Feb 13 '19

How big it is?

1

u/dasfsi Feb 13 '19

Well, now they have to download almost twice as much stuff for barely any benefit

1

u/[deleted] Feb 13 '19

I’ve built web projects for very large video game industry companies. Library size of any sort is a huge thing. We can’t introduce anything the company isn’t already using. All of our own library tools are written in pure JS and thus are super lean because we have to consider page load on pages that millions of users will see.

If it’s a smaller site for some local company, the end size of whatever you’re delivering might not be a big deal. In the case of building a product for that many users, every bit counts. The idea of even wanting to introduce a new library can turn into a scheduled dev meeting.

3

u/gijovarghese Feb 13 '19

Decluttering dependencies is always good. It's one's decision to choose which library/framework. The size of the library, whether its a few bytes or megabytes, its just one factor while picking a library/framework. There are a lot of other factors.

Yes, I agree, JQuery is lightweight than React. That doesn't mean I've to use JQuery.

2

u/oppai_suika Feb 13 '19

Not sure why you're getting downvoted since I agree. I don't like adding extra dependencies either, particularly when it doesn't work naturally with the other libraries I'm using.

3

u/gijovarghese Feb 13 '19

Thanks :)

I'm wondering why there are people like this! Decluttering dependencies is always good. It's one's decision to choose which library/framework to choose

0

u/[deleted] Feb 13 '19

[deleted]

7

u/gijovarghese Feb 13 '19

No, I meant, I'd to use Bootstrap in my React app, for modals and other stuff. Since they want Jquery as a dependency I occasionally use them.

I'm not saying I want Bootstrap to use React instead of Jquery. Let them declutter it. Let users decide it

1

u/mikeyoung90 Feb 13 '19

I think they mean in react you pretty much have to build your components from the ground up, need a modal? You'll need to build one (unless using a library). So including bootstrap with jQuery when using react is pointless as you'll be writing the modal as a react component anyway

0

u/Conradfr Feb 13 '19

Yeah I didn't know so much people where triggered by Bootstrap or jQuery.

I guess they weren't there before these fantastic tools.