3 ms·
so the big reason here is actually React. Whether you like it or not, the developer momentum behind React/Vue is massive. And jquery works in weird ways with Re
by sandGorgon 8y ago
so the big reason here is actually React. Whether you like it or not, the developer momentum behind React/Vue is massive. And jquery works in weird ways with React/Vue. You can still make it work, but people are choosing to go with other frameworks.
so the removal is not really a "remove jquery" thing - but more of "make sure the framework javascript doesnt screw up react".
For example, look at some of the earliest comments there - https://github.com/twbs/bootstrap/pull/23586 https://github.com/twbs/bootstrap/pull/23586
>If you are interested in Vanilla JS versions of tooltip, popover, and scrollspy, We have versions that we use in [Bootstrap-Vue v1.0.0.beta.7](https://github.com/bootstrap-vue/bootstrap-vue https://github.com/bootstrap-vue/bootstrap-vue) (see in action at [docs](https://bootstrap-vue.js.org/))* https://bootstrap-vue.js.org/))*
> Boostrap-Vue is quite interested in the jQuery free version of some of the plugins, as we might be able to direclty import some of these modues (or the classes), to replace some of our code.*
> Any chance this can be implemented as custom elements, this way everything would be nicely compatible with all component frameworks.
- paulddraper 8y agoWhat does jQuery do to play poorly with React that this reimplementation doesn't?
- petilon 8y agoI have used jQuery in a React app without issues. It is no worse than making direct DOM calls. React is great for rendering, but you can’t implement direct-manipulation on top of virtual DOM. Direct-manipulation means interactively resizing, drag & drop and so on. To implement this you need to know the position and size of real DOM elements. There is no "React way" to query the position and size of elements, so interactivity has to be implemented the old-school way, by interacting with real DOM. You can call native DOM methods to do this, but jQuery makes it easy. There are lots of shortcuts in jQuery. You can certainly do it without jQuery too, but unless reducing download size by around 85KB is very important to you, there is no reason you shouldn’t take advantage of the ease-of-use of jQuery. Keep in mind that once you manipulate DOM directly (using jQuery or not) React can’t update those elements. For more on this look up "Integrating with Other Libraries" in React documentation.
- wuliwong 8y ago> There is no "React way" to query the position and size of elements, so interactivity has to be implemented the old-school way, by interacting with real DOM. I have helped build an interactive timeline web app where we explicitly placed elements on the page and moved them around based on user interactions. We did this with react and no jquery. >React is great for rendering, but you can’t implement direct-manipulation on top of virtual DOM. Direct-manipulation means interactively resizing, drag & drop and so on. There are react "drag and drop" libraries that have no dependency on jquery and don't break the react lifecycle for the elements. For example https://github.com/react-dnd/react-dnd https://github.com/react-dnd/react-dnd Maybe i'm not following what you are saying but I haven't encountered something that required me to use jquery and I've built some pretty ambitious interfaces.
- sandGorgon 8y agoReact lifecycle - the virtual dom breaks down when you are manipulating the dom directly. It can still be done, but it's a bit weird. Incidentally one of the most interesting react apps that plays super nice with jQuery is the new WordPress editor. I have nothing but respect at how they made it work with the tons of bad js code out there.
- Carpetsmoker 8y agoThis sounds like a valid goal as such, but I don't quite follow how this refactor will really make things better? As I understand it, it will still use the same fundamental techniques (modifying the DOM directly), just without using the jQuery API?