Update RulesOfHooks.js

This commit is contained in:
Dan Abramov 2019-08-21 15:43:18 +01:00 committed by GitHub
parent a7e2223c35
commit d5193147a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -432,8 +432,7 @@ export default {
'React Hook function.';
context.report({node: hook, message});
} else if (codePathNode.type === 'Program') {
// We could warn here but there are false positives related
// configuring libraries like `history`.
// These are dangerous if you have inline requires enabled.
const message =
`React Hook "${context.getSource(hook)}" cannot be called ` +
'at the top level. React Hooks must be called in a ' +