Introduction distal --------- React heart note (1)

React profile:

React JAVASCRIPT is used to build a library user interface.

React mainly used to build the UI, many people think React is in MVC V (view).

React internal project originated in Facebook, and Instagram to set up a website and open in May 2013.

React has a high performance, code logic is very simple, more and more people have started to pay attention and use it.

 

The reason React birth

  The main market was these frameworks are unable to meet the business needs of the company facebook (1 large amounts of data, poor data management 2. page DOM structure can not be good Multiplexing)

facebook house engineers to find ways to address these needs, through efforts to find a solution, open source react.

 

T questions: talk react most notable feature?

1.flux unified data management thinking (high order)

2. Virtual DOM concepts (virtual DOM): js object using a real way to describe DOM element in the back of the data changes, so that the new and the old virtual virtual DOM DOM generated is diff algorithms are compared, results difference (patch), then the patch to update the page.

3. The assembly of: multiplexing can be extracted from the code, forming a single structure. (Html ​​tag 1. Structure 2. 4. Data pattern 3 formed state)

 

Attachment:

First introduced the concept of virtual DOM (the main reason is not to introduce the concept of MVC in front of the time, in which jQuery's existence, we are all DOM manipulation, listening through the DOM, DOM selected operation, if the amount is not operating, it will not produce much of a problem, but once the business complex, the amount of data is large, the DOM this time if it continues to operate, it is still consuming performance, underlying browser is doing is rendering and redraw consumption performance, as far as possible we should reduce redraw the main reason is because during development, sometimes only part of the data changes, in fact, on the main page's DOM structure has not changed much, a lot of DOM can be multiplexed) Facebook's engineers to introduce virtual DOM (using javascript objects to describe the way a DOM structure, and then to compare the old and new virtual DOM DOM through virtual diff algorithm, obtained difference (patch patch) snabbDOM h function patch). Note: Due to the introduction of virtual DOM makes the page load performance has been significantly improved, so that some other MVVM framework behind, have introduced the concept of virtual DOM. For example vuejs is borrowed react inside a virtual DOM (virtual DOM) Note: The concept of a virtual DOM is Facebook's engineers came up with. But the underlying diff algorithm is not Facebook's first, very early with the diff algorithms.

 

React to solve the problem?

1. Data 2. Unified management performance 3. Code reuse

 

jsx grammar

What is jsx grammar?

        jsx translates javascript + xml. To put it plainly is to allow developers to directly write html code (tag) in js context, without the use of quotation marks parcels.

Why introduction jsx grammar?

 A: We react to introduce virtual DOM, but using react native api virtual DOM, too much trouble  React.CreateElement (tagName, tagAttr, tagContent) . The introduction of a new syntax  jsx (javascript + xml) To put it plainly: You can write html code (the underlying reason is the use of webpack call babel conversion) in js context. We jsx syntax write code, called: jsx elements, jsx Code, react element.

  jsx Benefits: developers.

Reference website: https://zh-hans.reactjs.org/docs/introducing-jsx.html

 

Libraries and frameworks What is the difference? (Talk about the difference between the libraries and frameworks?)

            This is a jquery library; vuejs is a framework. Simple: only a tool set library (inside the package many useful functions, methods). Framework is a proven solution (framework which can organize a lot of libraries). vuejs data driver, no DOM operation (or to the bottom vuejs DOM operations, especially operations substantially encapsulate the underlying DOM).

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/hudunyu/p/11575184.html