Raivo Laanemets. Software consultant.

What React does not solve

React goes a long way to provide a sane approach for building large-scale complex frontend solutions but it does not solve everything. One of such use cases is the manipulation of existing markup.

Sometimes I need to add some interactivity to server-generated HTML. For example, to implement inline form validation. The server-side HTML might be generated by an ExpressJS application or WordPress or just be a set of static HTML files. Majority of web sites actually work this way. The alternative approach is to generate HTML (or rather the DOM tree) on the client. This is what React and many other view libraries or frontend frameworks try to do.

React wants to generate and fully control your DOM. It has the JSX language extension to do it and a clever internal mechanism to make DOM interactions fast. However, it does not make much sense to use it for scripting the existing markup. This is the use case solved better with jQuery or nowadays with plain browser APIs if you do not target the old browsers. View libraries that bind to HTML are also a good choice here. Two of such libraries are Knockout and Vue.js.


No comments have been added so far.

Email is not displayed anywhere.
URLs (max 3) starting with http:// or https:// can be used. Use @Name to mention someone.