Closed cbbfcd closed 3 years ago
as the title 🚀
@cbbfcd
const onClickAwayRef = useRef(onClickAway); onClickAwayRef.current = onClickAway;
这个依赖不用加,onClickAwayRef.current 是对象引用,onClickAway 发生变化的时候,useEffect 回调中的 onClickAwayRef.current 自然就跟着变了。
onClickAwayRef.current
onClickAway
useEffect
as the title 🚀