Hook
What is Hook?
Hook: In React, a function that lets you manage state and side effects inside a functional component (e.g. `useState`, `useEffect`). More broadly, a hook is a callback invoked at a specific point in a lifecycle. A hook is a point where your code can plug into a process run by something else. In React, hooks like useState and useEffect let function components hold state and react to changes. In general, a hook is a callback that runs at a specific moment in a lifecycle.
Frequently asked questions about Hook
How is Hook used in practice?
Git has hooks that run before a commit or push. WordPress is built around hooks that let plugins change behaviour. Frameworks offer them for models being saved, requests arriving and deployments finishing.
What should you keep in mind with Hook?
Hooks keep systems extensible without changing their core. In React, follow the rules: call hooks at the top level and in the same order every render. In other systems, keep hook code fast and focused. A slow or failing hook affects everything that runs through that point.
At a glance
| Category | Core glossary |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |