Compatibility function that converts a React hook into a higher order component that can be used with class components.