ReReact · Lesson 5 of 8
Custom Hooks
Custom hooks are functions that start with `use` and call other hooks. They let you extract stateful logic into reusable pieces — without the complexity of class components or render props.
✦ Tip
The rule of hooks: call hooks at the top level of a component or custom hook — never inside conditions, loops, or nested functions. This ensures hooks run in the same order on every render, which is how React tracks which state belongs to which hook call.
The rule of hooks: call hooks at the top level of a component or custom hook — never inside conditions, loops, or nested functions. This ensures hooks run in the same order on every render, which is how React tracks which state belongs to which hook call.