-
Notifications
You must be signed in to change notification settings - Fork 47.1k
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
Bug: eslint-plugin-react-hooks not working inside of Promise #26186
Comments
How do you use hooks inside promises? Hooks should only be called in the body of components |
@DiFuks that is right, but I was not aware of it when I code it. And I think To be specific, the hook I was trying to access inside of promise is |
This is described in the documentation and any tutorials. I'm not the maintainer of react, but it seems to me that the plugin should not check such things. |
I think this issue is actually the anon function, which is reported here: #14404 Leaving this open to confirm fixing anon function fixes this. |
These though fail. Anon default export: facebook#21181 Promise callbacks: facebook#26186 Returning anon functions: facebook#22520
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
React version:
"eslint-plugin-react-hooks": "^4.2.0"
Link to code example:
rule of hook(eslint-plugin-react-hooks) did not fire when it is inside of a Promise block. Please find the detailed explanation in example code below. thx
https://codesandbox.io/s/romantic-austin-uyoiyj?file=/src/generateSomething.js
The text was updated successfully, but these errors were encountered: