Skip to content

Instantly share code, notes, and snippets.

@thulioph
Last active September 11, 2018 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thulioph/164630f24455825e7c872dbfd4ffcf01 to your computer and use it in GitHub Desktop.
Save thulioph/164630f24455825e7c872dbfd4ffcf01 to your computer and use it in GitHub Desktop.
An example to demonstrate the lifecycle API of Recompose
import React from 'react';
import { lifecycle } from 'recompose';
const MyComponent = ({ data }) => (
<div>{data}</div>
);
const MyComponentModified = lifecycle({
componentDidMount() {
doSomething().then(data => {
this.setState({ data });
})
}
})(MyComponent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment