What is a higher-order component?

  • A component that takes another component and returns a new component
  • What it doesn't do...
    • it doesn't modify the input component
    • doesn't use inheritance to copy an input component's behavior
  • Wraps additional behavior around an input component

2 Concepts to Understand

  1. Functions as first class objects -> functions can be assigned to variables, passed as arguments in function paramaters, and returned from functions - just like strings, arrays, and objects
  2. callbacks -> function passed as an argument is a "callback"

References

https://tylermcginnis.com/react-higher-order-components/