This period of time to learn react.js, here to do a summary.
React.js on the advantage I think is two big point, first is the performance, the author from the DOM operation actually, through the virtual DOM (here Virtual Dom is actually in the JSX format syntax to pre-build the DOM structure and then through the browser or server-side rendering to HTML DOM elements) implementation. React noted that the impact of page performance is largely the cause of DOM operations, so it provides a mechanism for the identification of Dom update policy, on-demand updates, performance greatly improved.
The second point is the component convenience, see the following code:
var input=react.createclass ({ getinitialstate:function () { return{value: "Please enter ..."}, Handelclick: function () { this.setstate ({ value: "Please enter", });}, render:function () { return ( <div> <input type= "text" classname= "A1" Placeholder={this.state.value} onchange={this.handelclick}/> ( </div>);}}); Reactdom.render ( <input/>, document.getElementById ("EXM"));
React.createclass () Creates a Component object that is assigned to the variable Newele, where Newele acts as a custom element tag that can be rendered as a component into the real DOM. The process is simple, and each label is a separate component, which has the advantage of being low-coupling and easy to stack for building the DOM structure. When you write react, you will only notice that you are writing components, and you seldom focus on individual elements. This is where react has a great advantage.
React's disadvantage is that it is a little bit different, JSX syntax differs from the JS syntax, it takes time to get familiar. Focusing on the view layer, it requires other architectures such as flux to build the MVC development pattern.
React Simple Talk