- Updated all packages on development.
- Added tests and demos of
React.cloneElement
andReact.createFactory
. - We found out
React.createFactory
skipped the monkey patch we apply onReact.createElement
thus the following code didn't work:
import {lifecycle} from 'recompose';
const PostsList = ({ posts }) => (
<ul>{posts.map(p => <li>{p.title}</li>)}</ul>
);
const PostsListWithData = lifecycle({
componentDidMount() {
fetchPosts().then(posts => {
this.setState({ posts });
})
}
})(PostsList);
PostsList.whyDidYouRender = true;
because lifecycle
uses React.createFactory
to create it's child which is PostsList
in this case:
https://github.com/acdlite/recompose/blob/master/src/packages/recompose/lifecycle.js