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



项目地址

  • 教程作者:
  • 教程地址:
  • 代码仓库地址:
  • 所用到的框架和插件:
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如何工作
  • 用JS模拟DOM,变化时,只在JS上计算
posted @ 2025-09-22 12:23  yfceshi  阅读(4)  评论(0)    收藏  举报