paulgray.net

Posts about higher order components:

Chainable Components
September 04, 2018
The easiest way to write DRY reusable React components is with Render Props. However, they aren’t inherently succinct or easy combine. HOCs are an equivalent way to write DRY React components, and offer more composability, but leave a lot to be desired. Fortunately, we can realize a more composable and succinct API for reusable React components. The Essence of reusable React...
Typing HoCs
July 13, 2018
The process of writing a type signature for a HoC can be daunting at first. In this post, I’ll build an HoC and detail the process of writing a type signature for it. The HoC we’ll develop will be simple; it’ll take a promise, and handle the state-management, providing the inner component with the value, and whether it is loading...
How to write an HOC (in 3 easy steps).
January 02, 2018
How to write an HOC (in 3 easy steps). A lot of times when writing software we end up solving similar problems in similar ways. Sometimes we even copy-paste a chunk of code and change just a little bit of it. If you’ve done this before, don’t feel bad; every developer has done this at some point in their career. If...