Skip to content
New issue

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

是否考虑新增一个usedeepCompareMemo #2171

Open
xiaolifeipiao opened this issue Apr 24, 2023 · 4 comments
Open

是否考虑新增一个usedeepCompareMemo #2171

xiaolifeipiao opened this issue Apr 24, 2023 · 4 comments
Labels

Comments

@xiaolifeipiao
Copy link

No description provided.

@crazylxr
Copy link
Collaborator

要不暴露一个 createDeepCompare 的 hook,然后自己去包 useDeepCompareMemo、useDeepCompareCallback、useDeepCompareEffect 把

@hchlq
Copy link
Collaborator

hchlq commented Apr 25, 2023

+1

@YinDongFang
Copy link
Contributor

YinDongFang commented Apr 26, 2023

可以扩展一下deps参数的数据类型?比如支持 { deep: true, deps: [dep1, dep2] } 这种结构,这样全部的 useXxxxxEffect 都不用额外封装就可以支持deepCompare

甚至可以额外支持strictNull:是否严格区分null,undefined, compare:自定义比较函数等

@crazylxr crazylxr added the v4 label May 16, 2023
@liuyib
Copy link
Collaborator

liuyib commented Sep 28, 2023

对应 PR: #1972

相关问题:#2327 (comment)


应该还需要加个参数来控制“是否深拷贝值”然后用于对比:

https://github.com/alibaba/hooks/pull/2327/files

image

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

Successfully merging a pull request may close this issue.

5 participants