Functional Higher Order Components (HOCs) with Typescript

Updated: 03 September 2023

An HOC in React is a component that wraps another component to provide additional props or functionality to the wrapped component

Here’s a simple example of how we can create an HOC using Typescript:

The component below will provide an isVisible prop to a component which will alolow us to show or hide it selectively