React 基础 —— 各种 hooks 的使用场景
摘要:hooks 1. useRef ref 属于组件实例的共享变量(相当于class 组件中的 this.xxx)。直接修改 ref.current 不会触发组件的重渲染。 Caveats ① 常用于事件处理函数中共享与读写 ref import { useRef } from 'react'; exp
阅读全文
posted @ 2023-12-23 23:57