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.useState } from "react";
function function useToggle(): readonly [boolean, () => void]
useToggle() {
const [const value: boolean
value, 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.useState(false);
return [const value: boolean
value, () => const setValue: (value: React.SetStateAction<boolean>) => void
setValue((x: boolean
x) => !x: boolean
x)] as type const = readonly [boolean, () => void]
const;
}