const Connect = ComposedComponent =>
class extends React.Component {
state = { name: "" }
componentDidMount() {
//fetching data is a part of HOC
getAsync('https://imaginary-api.gorrion.io/name')
.then(({ name }) => { this.setState({ name: name }) })
}
render() {
return (
<ComposedComponent
{...this.props}
name={this.state.name}
/>
)
}
}