Last active
November 6, 2017 19:56
-
-
Save Siemko/e49b9337f62a41d59c4d7979f1189d70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | |
/> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment