Hacker News new | ask | show | jobs
by rbosinger 2945 days ago
As a member of a busy, small team with a Rails app and a jQuery heavy front-end... I agree. We use React in a few places and wanted to simply introduce it slowly and "convert to React where we could". It simply has not worked out for us. We have typical server side rendered HTML that has been progressively enhanced with sprinkles of JS (jQuery + various plugins). We do not and cannot book much developer time for refactoring and can only really improve the code itself in bits using the "boy scout rule" (leave the area you're working on better than you found it). For us, it turns out that yanking out chunks of jQuery and replacing them with React did not work out very well.
1 comments

Thanks for sharing, this is exactly what I am considering doing at the moment.

Any thoughts on https://news.ycombinator.com/item?id=17213264?

For us the difficulty is that with React you need to let React control it's piece of the DOM. We have lots of jQuery UI components. For example, we use Select2. So let's say a dev tries to redo a jQuery heavy form in React. It's mostly fine but there's a Select2 component in there and some WYSIWYG jQuery plugin on a text area. You can't just initialize those with the React component because React will complain about jQuery touching the DOM it controls. So now you either have to find React versions of those jQuery components or properly wrap the jQuery components you have with React which, IMO, can be a bit funky and ends up feeling kind of wrong. Basically, you can end up down a rabbit hole. If you're intention is to truly modernize you're JS and your happy to rip out old jQuery plugins and make changes like that then it's fine. We just didn't have the dev budget to always be doing that.