Basic understanding of react two

1. Understand the role of Virtual DOM and key attributes

  1. JSX Operating basis,Virtual DOM

  2. Virtual DOMwork as follows:

  • Breadth first stratified comparison
  • The root node starts to compare
  • Attribute changes and order
  • Node type changes
  • Nodes move across layers
  1. Virtual DOMtwo assumptions, as follows:
  • The component DOMstructure is relatively stable
  • Sibling nodes of the same type can be uniquely identified

2. Component design mode, high-level components and functions as sub-components

  1. The other two forms of component reuse, higher-order components and functions as sub-components

  2. High-level components HOC, high-level components accept components as parameters and return new components

  3. As a function of sub-assembly, a component rendercontent, determined by a user

  4. Both high-level components and function sub-components are design patterns, which can achieve component reuse in more scenarios

Three, understand the new Context API and its usage scenarios

  1. React 16.3The new feature is Context APIused to solve the communication between components. provideIs the root node, is the node that consumeuses it, and Contextis the global successor

Fourth, use scaffolding tools to create React projects

  1. Created using scaffolding tool Reactapplications,Create React App,Codesandbox,Rekit

Five, packaging and deployment

  1. Why do you need to package, as follows:
  • Compiler ES6syntax features, compilationJSX
  • Integrate resources, such as pictures,Less/Sass
  • Optimize code size
  1. Packing considerations are as follows:
  • Setting nodejsenvironmentproduction
  • Disable development-specific code, such as logger
  • Set the application root path

Guess you like

Origin blog.csdn.net/weixin_42614080/article/details/115036852