Front-end/react/qf/2.md

38 lines
804 B
Markdown
Raw Normal View History

2023-11-22 06:14:28 -05:00
在事件中调用函数不加(),加()后直接执行并且返回undefined。
# 函数方法调用
![](img/函数写法1微信截图_20231027164242.png)
![](img/函数写法微信截图_20231027164242.png)
# 类中this指向问题
## 箭头函数
this指向外部类的this
## 普通函数
this谁调用指向谁
# 关键字
call 改变this自动执行函数
apply 改变this自动执行函数
bind 改变this不自动执行函数 。需要加()执行函数
# 类组件
ref引用
![](img/ref微信截图_20231027180729.png)
# 函数组件
状态hook
## 严格模式
React.StrictMode
# state
# 数组循环渲染
key值解析
虚拟dom
尽量不去修改原状太 ...赋值中间变量
split(删除位置索引,删除个数)
2023-12-02 00:44:52 -05:00
## 解构传入参数
![](img/解构_20231115182542.png)