I've created a recompose lifecycle HOC... See the code for component to see how I am using the HOC with my components.
Is there a way to avoid needing to describe the PropTypes for the HOC wrapping:
Component:
import React from 'react';
import PropTypes from 'prop-types';
const MyPage = () => (
<div>stuff</div>
);
const WrappedMyPage = withMyCustomThing({
a: 'value',
b: 'value',
})(MyPage);
WrappedMyPage.contextTypes = {
myItem: PropTypes.object.isRequired,
};
export default WrappedMyPage;
HOC Recompose Lifecycle
import { lifecycle } from 'recompose';
function withMyCustomThing() {
return lifecycle({
....
export default withMyCustomThing;