Skip to content

Conversation

FanetheDivine
Copy link

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

为了同步地“监听”某些变量

const prevId = useRef(id)
if(prevId.current!==id){
  xxx
}
prevId.current = id

把上面的逻辑上拓展为多变量、有cleanup函数 就是useImmediateEffect

📝 Changelog

Language Changelog
🇺🇸 English add useImmediateEffect
🇨🇳 Chinese 新增 useImmediateEffect

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@crazylxr
Copy link
Collaborator

crazylxr commented Aug 8, 2025

这个 hook 我感觉不太需要

如果是是要做 effect 的事情,用useLayoutEffect 就行,如果是为了同步获取计算值,useMemo 即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants