|
|
|
|
|
by rtpg
3131 days ago
|
|
There's a lot of jquery code out there that's basically lines and lines of for loops to maintain a state machine. Stuff that all these nice frameworks handle for you in a clean, bug-free way. Almost every day of the year, <div id='business-class' ng-class="{selected:seatType=='business'}">
Business Class
</div>
feels better to me than: $('#seat_type').on('change', function(){
if(this.value == 'business'){
$('#business-class').addClass('selected');
} else {
$('#business-class').removeClass('selected');
}
});
There are other considerations, angular/React aren't the only solutions to this... but having something to handle this sort of stuff cleanly and generally is a no-brainer to me.jQuery's an amazing tool at the low level, but there are some higher-layer stuff we can easily apply to manage state. |
|