react related knowledge summary

1 JSX resolve problems

JSX is actually syntactic sugar;

JSX development environment will be compiled into a JS code

 

The method defined react, for parsing html, the first parameter is "html elements", the second parameter is the "property", the third parameter is the child element;

It will turn into the following html:

Another example:

Verify: Use of babel transfrom-react-jsx translation plug-in to react Code:

Translated:

 

In addition, react is how to build self-defined label it?

Compiled:

React vDom is the first time to promote open, combined with the use of JSX

h function ===== vue snabbdom in the _c function ====== react in createELement function are returned vnode, virtual dom

Then mount the first patch element by a function, a second diff

The above example vnode h generated as a function of the right side of the code;

====

 

Guess you like

Origin www.cnblogs.com/xiaozhumaopao/p/11620215.html