Skip to content

Commit

Permalink
Add higher-order component (HOC) definition
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepiercy committed Jan 3, 2025
1 parent 05a3bd5 commit 836d094
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -871,4 +871,18 @@ variation
Extending this example, a developer can add a boolean field to the block that toggles the display of the link.
Thus an editor can select between `title + link` or just `title`.
HOC
Higher-Order Component
A higher-order component (HOC) is an advanced technique in React for reusing component logic.
HOCs are not part of the React API, per se.
They are a pattern that emerges from React's compositional nature.
Concretely, a higher-order component is a function that takes a component and returns a new component.
```{important}
Higher-order components are not commonly used in modern React code.
```
```{seealso}
https://legacy.reactjs.org/docs/higher-order-components.html
```
```

0 comments on commit 836d094

Please sign in to comment.