Higher-order component is a function that takes a component as an argument and returns a new component with some additional functionality. It's a powerful technique for reusing component logic across multiple components, popularized by the React library but also used in other frameworks like Vue and Angular.
"I'm going to write a higher-order component to handle authentication for all our protected pages. That way we don't have to duplicate the auth checking logic in every component."
"Looks like the new intern got a little higher-order component happy - now there's so many layers of abstraction, I can't even tell what the actual UI is supposed to do anymore!"
The React docs have a good overview of and how to use them effectively in a React application. It covers the basics as well as some common pitfalls to avoid.
For a deeper dive, check out "Why You Should Give React on Medium. It goes into more advanced use cases and addresses some criticisms of the pattern.
If you're feeling nostalgic for the good old days of manually wiring up dependencies, this article compares . Spoiler alert: higher-order components are way cooler.
Note: the Developer Dictionary is in Beta. Please direct feedback to skye@statsig.com.