Rules
debug/react-hooks

debug/react-hooks

Rule category

Debug.

What it does

Reports all React Hooks. Useful for debugging. This rule should only be used for debugging purposes. Otherwise, leave it off.

Examples

import React, { function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1 overload)
Returns a stateful value, and a function to update it.
@version16.8.0@see{@link https://react.dev/reference/react/useState}
useState
} from "react";
function function useToggle(): readonly [boolean, () => void]useToggle() { const [const value: booleanvalue, const setValue: React.Dispatch<React.SetStateAction<boolean>>setValue] = useState<boolean>(initialState: boolean | (() => boolean)): [boolean, React.Dispatch<React.SetStateAction<boolean>>] (+1 overload)
Returns a stateful value, and a function to update it.
@version16.8.0@see{@link https://react.dev/reference/react/useState}
useState
(false);
return [const value: booleanvalue, () => const setValue: (value: React.SetStateAction<boolean>) => voidsetValue((x: booleanx) => !x: booleanx)] as type const = readonly [boolean, () => void]const; }