(一)React面试(虚拟DOM/类组件) - 详解
文章目录
项目地址
- 教程作者:
- 教程地址:
- 代码仓库地址:
- 所用到的框架和插件:
dbt
airflow
一、React基础
1.1 概念
1. 核心理念
- JSX 语法:是react语法糖,允许在html里写js,通过babel编译成为Js执行
- 函数式编程
- 虚拟DOM
- 组件话
2. 文件结构
index.js
is the js file that replaces the root elemnets of index.html file with newly redered components- app.js file contian the root component of react app and its defines the structure,layout, and routing in the appliaction
2. 什么是虚拟DOM
- 本质是一个对象,用来描述真实的DOM结构和属性的,存在内存中的。
- 直接操作DOM会导致重绘和重新计算,虚拟DOM可以提高性能
虚拟dom如何工作
- 用JS模拟DOM,变化时,只在JS上计算