5 ms·
React is great for rendering (and updating after initial render), but if your app is highly interactive then jQuery makes things easier even when using React fo
by interlocutor 8y ago
React is great for rendering (and updating after initial render), but if your app is highly interactive then jQuery makes things easier even when using React for rendering.
- thermodynthrway 8y agoYou generally don't mix react and JQuery. The event system + JSX makes jQuery obsolete. Having worked in complex interactive React/Angular apps as well as ones using JQuery, nobody would ever offer me enough to use JQuery again for this use case. They would have to double my pay for all the pain
- interlocutor 8y agoShow me a dropdown menu written in React and I'll show you how you can simplify the code significantly by using jQuery in addition to React.
- squiggleblaz 8y agoCan you be more concrete? If you want some specific code to criticise, there's dozens of dropdown menu widgets available: here's one I found in Google https://github.com/react-component/menu https://github.com/react-component/menu since I've never actually had reason to use a js/html drop down menu widget.
- interlocutor 8y agoHere's one that uses jQuery. See how much simpler it is? The one you found does have more functionality, but try rewriting the one I found in React without using jQuery. I guarantee it will be much more complicated. https://github.com/wisercoder/uibuilder/blob/master/SimpleDemo/Views/ReusableComponents/PopupMenu.tsx https://github.com/wisercoder/uibuilder/blob/master/SimpleDe...
- thermodynthrway 8y agoIt's not about how complex the component is. In my experience what matters is how easy it is to use. With React it's easy to build a world in a teacup, and that's mostly a good thing. For "regular CRUD developers", the vast majority of us, I have zero concern about how big or crazy component code is until it's so huge it impacts page size. I'll use the easiest most feature complete library out there. React does encapsulation like jQuery never could. I don't care if I have this vanta black box on my page as long as it's easy to mess with and gets the job done
- interlocutor 8y agoYou don't care if the code is significantly simpler by using jQuery? I do care. Simpler code is likely to have fewer bugs and is easier to maintain.
- thermodynthrway 8y agoI'm talking about my code specifically. With React I can pull in a massively complex UI component in few lines. The complexity is shifted to the library that hopefully has thousands of users so is mostly bug free. It simplifies my code at the expense of moving complexity to the shared project. Much preffered since my code will see orders of magnitude less usage than the library itself
- j16sdiz 8y agoI care debugibilty and maintainibility. Many projects on github have very short life cycle. If it go unmaintained, how easy can I take over it?
- thermodynthrway 8y agoI would argue that most websites have a lifetime similar to the components :). For the ones that don't, backwards compatibility on the web is amazing, only thing to worry about is security vulns
- thermodynthrway 8y agoDevelopment with React is becoming similar to old school event driven desktop apps, thankfully. If I want a fancy drop-down with accessibility support and theming etc, there's probably 50 different libraries with components I can pull in and use with little fuss. A few lines of code to import and register event listeners. I was a huge user of jQuery for years, and it also has quite nice UI libraries. But the power of React is the standardized scaffold and lifecycle. I can pull in UI components from almost any library and use them intuitively. Mix and match them on the same page. Trying to do that in jQuery will quickly drag you to hell.
- mariusmg 8y ago>Trying to do that in jQuery will quickly drag you to hell. Can you elaborate on this please ? I've used lots of libraries with jquery and haven't encountered problems.
- thermodynthrway 8y agoEasy to cause it by combining bootstrap components and JQueryUI. In React you can "scope" a components CSS so none of the styling leaks out
- ben-schaaf 8y agoWhat do you even need javascript for in a dropdown?
- boubiyeah 8y agoyou are seriously mistaken about react then. The whole point of MV libs is that you maintain a model (domain and/or UI) and the UI just redraws itself. JQuery is 100% not needed even for the most complicated React apps.
- petilon 8y agoWhen you have a highly interactive component you're going to need to make a lot of DOM calls to get the current state of the elements and so on. jQuery makes this easy. The benefits of jQuery over making raw DOM calls have been mentioned by many people here already, so I won't repeat them. These benefits of jQuery don't go away even in a React app.