Error ------------------------------------------------------------------------------ hooks_in_class_in_component.js:5:22 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] hooks_in_class_in_component.js:5:22 5| field: unknown = useState(); // error: react-rule-hook-class ^^^^^^^^^^ References: hooks_in_class_in_component.js:5:22 5| field: unknown = useState(); // error: react-rule-hook-class ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------- rules_of_hooks.js:74:3 Unreachable code. [unreachable-code] 74| useHook(); // flow unreachable error ^^^^^^^^^^ Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:523:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:523:5 523| useHook(); // error ^^^^^^^^^ References: rules_of_hooks.js:523:5 523| useHook(); // error ^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:539:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:539:1 539| Hook.useState(); // error ^^^^^^^^^^^^^^^ References: rules_of_hooks.js:539:1 539| Hook.useState(); // error ^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:541:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:541:1 541| Hook.use42(); // error ^^^^^^^^^^^^ References: rules_of_hooks.js:541:1 541| Hook.use42(); // error ^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:542:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:542:1 542| Hook.useHook(); // error ^^^^^^^^^^^^^^ References: rules_of_hooks.js:542:1 542| Hook.useHook(); // error ^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:555:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:555:5 555| This.useHook(); // error ^^^^^^^^^^^^^^ References: rules_of_hooks.js:555:5 555| This.useHook(); // error ^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:556:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:556:5 556| Super.useHook(); // error ^^^^^^^^^^^^^^^ References: rules_of_hooks.js:556:5 556| Super.useHook(); // error ^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:584:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:584:5 584| Namespace.useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:584:5 584| Namespace.useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:595:7 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:595:7 595| useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:595:7 595| useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:607:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:607:5 607| useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:607:5 607| useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:617:7 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:617:7 617| useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:617:7 617| useConditionalHook(); // error ^^^^^^^^^^^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:628:10 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:628:10 628| cond ? useTernaryHook() : null; // error ^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:628:10 628| cond ? useTernaryHook() : null; // error ^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:638:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:638:5 638| useHookInsideCallback(); // error ^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:638:5 638| useHookInsideCallback(); // error ^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:649:7 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:649:7 649| useHookInsideCallback(); // error ^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:649:7 649| useHookInsideCallback(); // error ^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:679:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:679:5 679| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:679:5 679| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:690:7 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:690:7 690| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:690:7 690| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:703:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:703:5 703| useHookInsideLoop(); // error ^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:703:5 703| useHookInsideLoop(); // error ^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:712:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:712:3 712| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:712:3 712| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:726:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:726:3 726| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:726:3 726| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:734:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:734:3 734| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:734:3 734| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:737:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:737:3 737| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:737:3 737| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:748:5 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:748:5 748| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:748:5 748| useHookInsideNormalFunction(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:763:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:763:5 763| useHook1(); // error ^^^^^^^^^^ References: rules_of_hooks.js:763:5 763| useHook1(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:765:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:765:5 765| useHook2(); // error ^^^^^^^^^^ References: rules_of_hooks.js:765:5 765| useHook2(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:768:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:768:5 768| useHook3(); // error ^^^^^^^^^^ References: rules_of_hooks.js:768:5 768| useHook3(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:770:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:770:5 770| useHook4(); // error ^^^^^^^^^^ References: rules_of_hooks.js:770:5 770| useHook4(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:784:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:784:5 784| useHook1(); // error ^^^^^^^^^^ References: rules_of_hooks.js:784:5 784| useHook1(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:786:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:786:5 786| useHook2(); // error ^^^^^^^^^^ References: rules_of_hooks.js:786:5 786| useHook2(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:796:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:796:5 796| useHook(); // error ^^^^^^^^^ References: rules_of_hooks.js:796:5 796| useHook(); // error ^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:807:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:807:3 807| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:807:3 807| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:810:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:810:3 810| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:810:3 810| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:813:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:813:3 813| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:813:3 813| useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:815:16 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:815:16 815| let dx = () => useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:815:16 815| let dx = () => useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:818:3 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:818:3 818| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:818:3 818| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:822:5 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:822:5 822| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:822:5 822| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:827:5 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:827:5 827| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:827:5 827| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:831:7 Cannot assign `() => void` to `j` because `() => void` [1] is incompatible with `empty` [2]. [incompatible-type] rules_of_hooks.js:831:7 v------------------------------ 831| j = () => { // unrelated flow error 832| useState(); // error 833| }, ^ [1] References: rules_of_hooks.js:831:3 831| j = () => { // unrelated flow error ^ [2] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:832:5 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:832:5 832| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:832:5 832| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:838:5 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:838:5 838| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:838:5 838| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:857:3 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:857:3 857| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:857:3 857| useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:870:3 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:870:3 870| useState();// error ^^^^^^^^^^ References: rules_of_hooks.js:870:3 870| useState();// error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:883:3 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:883:3 883| useState();// error ^^^^^^^^^^ References: rules_of_hooks.js:883:3 883| useState();// error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:890:8 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:890:8 890| a && useHook1(); // error ^^^^^^^^^^ References: rules_of_hooks.js:890:8 890| a && useHook1(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:891:8 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:891:8 891| b && useHook2(); // error ^^^^^^^^^^ References: rules_of_hooks.js:891:8 891| b && useHook2(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:901:5 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:901:5 901| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:901:5 901| useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:912:21 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:912:21 912| let foo1 = bar && useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:912:21 912| let foo1 = bar && useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:913:21 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:913:21 913| let foo2 = bar || useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:913:21 913| let foo2 = bar || useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:914:21 Cannot call hook [1] because React hooks cannot be called in conditional contexts. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:914:21 914| let foo3 = bar ?? useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:914:21 914| let foo3 = bar ?? useState(); // error ^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:956:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:956:1 956| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:956:1 956| useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:958:15 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:958:15 958| const foo = ReactWithHooks.useCallback(() => {}); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:958:15 958| const foo = ReactWithHooks.useCallback(() => {}); // error ^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:960:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] rules_of_hooks.js:960:1 960| useCustomHook(); // error ^^^^^^^^^^^^^^^ References: rules_of_hooks.js:960:1 960| useCustomHook(); // error ^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:978:7 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:978:7 978| useFeatureFlag(); // error ^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:978:7 978| useFeatureFlag(); // error ^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:986:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:986:5 986| ReactWithHooks.useState(); // error ^^^^^^^^^^^^^^^^^^^^^^^^^ References: rules_of_hooks.js:986:5 986| ReactWithHooks.useState(); // error ^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------------------ rules_of_hooks.js:993:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:993:5 993| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:993:5 993| useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:1000:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:1000:5 1000| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:1000:5 1000| useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:1007:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:1007:5 1007| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:1007:5 1007| useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:1014:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:1014:5 1014| useState(); // error ^^^^^^^^^^ References: rules_of_hooks.js:1014:5 1014| useState(); // error ^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:1026:3 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] rules_of_hooks.js:1026:3 1026| use(promise); // error ^^^^^^^^^^^^ References: rules_of_hooks.js:1026:3 1026| use(promise); // error ^^^ [1] Error ---------------------------------------------------------------------------------------- rules_of_hooks.js:1030:14 Cannot call hook [1] because React hooks can only be called within components or hooks. Flow cannot prove that this hook is called unconditionally. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-conditional] rules_of_hooks.js:1030:14 1030| const text = use(promise); // error ^^^^^^^^^^^^ References: rules_of_hooks.js:1030:14 1030| const text = use(promise); // error ^^^ [1] Error ----------------------------------------------------------------------------------------- rules_of_hooks.js:1038:5 Cannot call hook [1] because React hooks cannot be called in classes. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-class] rules_of_hooks.js:1038:5 1038| use(promise); // error ^^^^^^^^^^^^ References: rules_of_hooks.js:1038:5 1038| use(promise); // error ^^^ [1] Error ------------------------------------------------------------------------------------- syntax_compatibility.js:15:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] syntax_compatibility.js:15:1 15| useHook(); // Error ^^^^^^^^^ References: syntax_compatibility.js:15:1 15| useHook(); // Error ^^^^^^^ [1] Error ------------------------------------------------------------------------------------- syntax_compatibility.js:42:5 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] syntax_compatibility.js:42:5 42| useHook(); // Error ^^^^^^^^^ References: syntax_compatibility.js:42:5 42| useHook(); // Error ^^^^^^^ [1] Error ------------------------------------------------------------------------------- syntax_compatibility_import.js:3:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] syntax_compatibility_import.js:3:1 3| useHook(); // Error ^^^^^^^^^ References: syntax_compatibility_import.js:3:1 3| useHook(); // Error ^^^^^^^ [1] Error ------------------------------------------------------------------------------- syntax_compatibility_import.js:4:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] syntax_compatibility_import.js:4:1 4| useHooklikeAnnotatedFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: syntax_compatibility_import.js:4:1 4| useHooklikeAnnotatedFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------- syntax_compatibility_import.js:5:1 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] syntax_compatibility_import.js:5:1 5| useDeclaredHooklikeFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: syntax_compatibility_import.js:5:1 5| useDeclaredHooklikeFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------ syntax_compatibility_import.js:27:5 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] syntax_compatibility_import.js:27:5 27| useHook(); // Error ^^^^^^^^^ References: syntax_compatibility_import.js:27:5 27| useHook(); // Error ^^^^^^^ [1] Error ------------------------------------------------------------------------------ syntax_compatibility_import.js:28:5 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] syntax_compatibility_import.js:28:5 28| useHooklikeAnnotatedFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: syntax_compatibility_import.js:28:5 28| useHooklikeAnnotatedFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ------------------------------------------------------------------------------ syntax_compatibility_import.js:29:5 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] syntax_compatibility_import.js:29:5 29| useDeclaredHooklikeFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: syntax_compatibility_import.js:29:5 29| useDeclaredHooklikeFunction(); // Error: it's assumed to be hook ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------------------- test.js:19:5 Cannot call function because callee [1] has a name that indicates it is a React hook (starting with `use`) but it is not defined with hook syntax. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-non-hook-syntax] test.js:19:5 19| useY(); // error: unsupported hook compatibility ^^^^^^ References: test.js:19:5 19| useY(); // error: unsupported hook compatibility ^^^^ [1] Error ----------------------------------------------------------------------------------------------------- test.js:20:5 Cannot call `useX` because `number` [1] is not a function. [not-a-function] test.js:20:5 20| useX(); // error for calling number but no hook error ^^^^ References: test.js:3:14 3| const useX = 42; ^^ [1] Error ----------------------------------------------------------------------------------------------------- test.js:24:5 Cannot call `useV` because a call signature declaring the expected parameter / return type is missing in `{readonly default: () => void, readonly useW: hook () => void}` [1]. [prop-missing] test.js:24:5 24| useV(); // error for calling module but no hook error ^^^^ References: exp2.js ^^^^^^^ [1] Error ----------------------------------------------------------------------------------------------------- test.js:29:5 Cannot call function because callee [1] has a name that indicates it is a React hook (starting with `use`) but it is not defined with hook syntax. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-non-hook-syntax] test.js:29:5 29| bag_o_hooks.useR(); // error: unsupported hook compatibility ^^^^^^^^^^^^^^^^^^ References: test.js:29:5 29| bag_o_hooks.useR(); // error: unsupported hook compatibility ^^^^^^^^^^^^^^^^ [1] Error ---------------------------------------------------------------------------------------------------- test.js:38:20 Cannot call hook [1] because React hooks can only be called within components or hooks. This hook is definitely not called in a component or hook. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-definitely-not-in-component-or-hook] test.js:38:20 38| const c1 = () => { useH() }; // error ^^^^^^ References: test.js:38:20 38| const c1 = () => { useH() }; // error ^^^^ [1] Error ---------------------------------------------------------------------------------------------------- test.js:40:43 Cannot call hook [1] because React hooks can only be called within components or hooks. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook] test.js:40:43 40| const C3 = id(({}: {}, ref: unknown) => { useH() }); // error ^^^^^^ References: test.js:40:43 40| const C3 = id(({}: {}, ref: unknown) => { useH() }); // error ^^^^ [1] Error ---------------------------------------------------------------------------------------------------- test.js:60:29 Cannot call function because callee [1] has a name that indicates it is a React hook (starting with `use`) but it is not defined with hook syntax. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-non-hook-syntax] test.js:60:29 60| const actionItems = useNodeActionItems(1); // error: params won't get `MakeHookLike` transform. Higher order hooks are not supported. ^^^^^^^^^^^^^^^^^^^^^ References: test.js:60:29 60| const actionItems = useNodeActionItems(1); // error: params won't get `MakeHookLike` transform. Higher order hooks are not supported. ^^^^^^^^^^^^^^^^^^ [1] Error ---------------------------------------------------------------------------------------------------- test.js:61:27 Cannot call function because callee [1] has a name that indicates it is a React hook (starting with `use`) but it is not defined with hook syntax. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-non-hook-syntax] test.js:61:27 61| const validator = useValidator?.(""); // // error: params won't get `MakeHookLike` transform. Higher order hooks are not supported. ^^^^^^^^^^^^^^^^^^ References: test.js:61:27 61| const validator = useValidator?.(""); // // error: params won't get `MakeHookLike` transform. Higher order hooks are not supported. ^^^^^^^^^^^^ [1] Error ----------------------------------------------------------------------------------------------------- test.js:65:9 Cannot call function because callee [1] has a name that indicates it is a React hook (starting with `use`) but it is not defined with hook syntax. (https://react.dev/reference/rules/rules-of-hooks) [react-rule-hook-non-hook-syntax] test.js:65:9 65| w.useXD(); // error: unsupported hook compatibility ^^^^^^^^^ References: test.js:65:9 65| w.useXD(); // error: unsupported hook compatibility ^^^^^^^ [1] Found 78 errors