Front-end/react/qf/2.md

35 lines
746 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

在事件中调用函数不加(),加()后直接执行并且返回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(删除位置索引,删除个数)