Skip to main content

Frontend engineering · Frameworks

Hooks

Also called: React Hooks, useEffect, Custom hooks, Composables

Functions in React that start with use. They give function components abilities like state and side effects, and you can also use them to package up reusable logic.

In detail

Think of hooks as "feature plug-ins" for components. useState lets a component remember data. useEffect lets a component do something after it shows up or when data changes (like calling an API). useRef gets you a DOM element. You can also turn logic you use a lot into a custom hook, like useUserInfo.

Hooks have two hard rules: only call them at the top level of a component or a custom hook, never inside an if or a loop; and their names must start with use. Break these rules and you'll get strange errors.

The most common beginner mistake is getting the useEffect dependency array wrong, which makes the API get called over and over, or even causes an infinite loop. In Vue, the similar concept is called Composables.

Developer info
Term ID
eng-hooks
DOM selectors
No DOM cues. This concept isn't detected directly on a page.
Priority
1 · when several match at the same level, the higher priority wins
Version
v1 · updated Sep 29, 2026