ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

(一)React面试(虚拟DOM/类组件) - 详解

(一)React面试(虚拟DOM/类组件) - 详解

文章目录

  • 项目地址
  • 一、React基础
    • 1.1 概念
      • 1. 核心理念
      • 2. 文件结构
      • 2. 什么是虚拟DOM
        • 虚拟dom如何工作
        • diff如何工作
        • 为什么react 不能返回多个元素
      • 3. what is sythetic event
      • 4. vite为什么好
      • 5. 类组件
        • 类组件
        • passing data in class components
        • Differences betwean functional and class
        • 函数这么好为什么还需要使用类
      • 6. props的不可变性
        • props drilling
          • how/why to avoid props drilling
    • 1.2 Hooks
      • 1. what are hooks


项目地址

  • 教程作者:
  • 教程地址:
  • 代码仓库地址:
  • 所用到的框架和插件:
dbt
airflow

一、React基础

1.1 概念

1. 核心理念

  1. JSX 语法:是react语法糖,允许在html里写js,通过babel编译成为Js执行
  2. 函数式编程
  3. 虚拟DOM
  4. 组件话

2. 文件结构

  1. index.js is the js file that replaces the root elemnets of index.html file with newly redered components
  2. app.js file contian the root component of react app and its defines the structure,layout, and routing in the appliaction

2. 什么是虚拟DOM

  1. 本质是一个对象,用来描述真实的DOM结构和属性的,存在内存中的。
  2. 直接操作DOM会导致重绘和重新计算,虚拟DOM可以提高性能
虚拟dom如何工作
返回列表