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

@reskript/no-useless-memo-hooks 对于 useCallback 误报的 case #359

Open
dancerphil opened this issue Jul 23, 2024 · 0 comments
Open

Comments

@dancerphil
Copy link
Contributor

重现 Case:

const getInitialValues = useCallback(
    () => template,
    [template]
);

@reskript/no-useless-memo-hooks 提示 Hook useCallback's should be removed

但实际上,我希望仅当 template 的值发生变更时使用新的 callback,而当 template 的值没有变化时不更新 callback 的引用。在这种情况下,useCallback 是需要的。

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

No branches or pull requests

1 participant