Development in general is moving towards more declarative than imperative frameworks and libraries.
With something like React you're describing what you want rendered, not how to render it. A component is only responsible for the bits it touches, and doesn't affect other parts of the page, and nothing else is going to come along and pull the rug out from under you.
With jQuery you're grabbing random bits of the page and mutating them without a cohesive rhyme or reason. You have to look over the entire code base to understand how the application works. Some other bit of code somewhere could change something out from underneath you and you'll never know about it till it breaks. This is how you end up with spaghetti code.
jQuery was useful in it's day as a nice abstraction over an ugly DOM API, and can be suitable for tiny minor jobs in a single page, but is not fit for purpose for architecting a full application.
This makes sense to me since I mostly work with small pieces of code (tags) and I rarely have an opportunity to build something bigger. That's why I haven't seen the downsides
49
u/cheekysauce Feb 13 '19
Development in general is moving towards more declarative than imperative frameworks and libraries.
With something like React you're describing what you want rendered, not how to render it. A component is only responsible for the bits it touches, and doesn't affect other parts of the page, and nothing else is going to come along and pull the rug out from under you.
With jQuery you're grabbing random bits of the page and mutating them without a cohesive rhyme or reason. You have to look over the entire code base to understand how the application works. Some other bit of code somewhere could change something out from underneath you and you'll never know about it till it breaks. This is how you end up with spaghetti code.
jQuery was useful in it's day as a nice abstraction over an ugly DOM API, and can be suitable for tiny minor jobs in a single page, but is not fit for purpose for architecting a full application.