React originated in Facebook's internal project because the company was dissatisfied with all the JavaScript MVC frameworks on the market and decided to write a set of Web sites that would be used to erect Instagram. After doing it, found that this set of things very useful, in May 2013, open source. Because React's design ideas are extremely unique, revolutionary and innovative, the code logic is simple. Therefore, more and more people are beginning to pay attention to and use, think it may be the mainstream tool of WEB development in the future.
1. JSX syntax
React uses JSX instead of regular JavaScript. JSX is a JavaScript syntax extension that looks much like XML.
Reactdom.render (<div>
We can nest multiple HTML tags in the above code, we need to wrap it with a DIV element (with only one outermost tag), the P element in the instance adds a custom attribute Data-myattribute, and the addition of the custom attribute requires the use of the data- prefix.
2, the application of components
Building components through React makes the code easier to reuse and can be used well in the development of large projects. The core of react is the component, the so-called component, which is a packaged, individually functional UI component. React recommends a component-based rethinking of the UI composition, defining each module that is functionally independent on the UI as a component, and then building the overall UI by composing or nesting the small components into large components. For example, Facebook's instagram.com entire site was developed using react, and the entire page was a large component that contained a large number of other components nested, and it was interesting to see the code behind it. Let's look at an example of a component:
var hellomessage = React.createclass ({ render:function () { return
The React.createclass method is used to generate a component class HelloMessage.
React some basics that you must know