We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
根据源码,createEffectWithTarget这个函数的主要目的是将target的变化也变成副作用Hook的执行依据
我的疑问 target是从ref引用获取的,ref是传递给对应DOM节点的,一般情况下,这个引用获取的对应的DOM对象是不会变化的,那么为什么要把这个target的变化也考虑进去呢,什么应用场景下会使得这个target变化呢?
The text was updated successfully, but these errors were encountered:
dom 对象在很多业务情况下都会发生改变吧?比如key值改变,条件渲染
Sorry, something went wrong.
DOM 发生变化很常见的哇,如楼上说的,如果你给列表里面的元素加了事件,列表发生了变化,比如删除了。
感谢回答,之前觉得ref都是固定在对应jsx节点上,所以jsx对应的DOM不会变,忽略了DOM会从新创建的问题了。
No branches or pull requests
根据源码,createEffectWithTarget这个函数的主要目的是将target的变化也变成副作用Hook的执行依据
我的疑问
target是从ref引用获取的,ref是传递给对应DOM节点的,一般情况下,这个引用获取的对应的DOM对象是不会变化的,那么为什么要把这个target的变化也考虑进去呢,什么应用场景下会使得这个target变化呢?
The text was updated successfully, but these errors were encountered: