Hooks

Rules of Hooks

Ordinary Hooks belong at the top of function components or custom Hooks before conditional returns.

Formal Syntax & Structure

react syntaxreact
const [value, setValue] = useState(initial);

Working Example

Example Snippetreact
const [open, setOpen] = useState(false);
React Reference