Replacing jQuery with React
2014-02-27
You probably already heard that you might not need jQuery anymore. In my side projects, I've been using jQuery heavily for
- handling AJAX
- updating HTML
- binding events
- binding data
For the first one, AJAX, jQuery is still a good alternative, or you can use some vanilla JS. For binding events and data, and most of all for updating HTML, React is a very interesting alternative. When using jQuery you have to keep track of how to change your HTML in response to events, which can be fairly cumbersome. With React on the other hand, changes to the application state are completely decoupled from changes to the HTML. As a matter of fact you don't need to consider any HTML changes at all; your code describes your HTML at any given time, but the actual changes are generated by the framework.
I've been spending some time lately replacing jQuery with React in some of my side projects, and I think React is a big improvment over jQuery.