React Simple Talk

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.