Hi, wanted to know the reason why you removed the lifecycle helper on your latest release (v0.18.0) and maybe open a vote on bringing it back in some form if anyone else uses / requires this feature.
My use case looks sth like this:
const options = new Options({})
export const mapOptions = (options) => {
return compose(
withState('options', 'updateOptions', options.get()),
mapProps(({updateOptions, ...rest}) => ({
onUpdateOptions: () => {
updateOptions(() => options.get())
},
...rest,
})),
lifecycle((component) => {
options.on('update', component.props.onUpdateFreezer)
}, () => {
options.off('update', component.props.onUpdateFreezer)
})
)
}
const options = new Options({})
const MyOptionComponent = mapOptions(options)(MyComponent)
options.set({foo: 'bar'}) // triggers 'update'
Basically options triggers update event on which I would like to update the props. Maybe there's a other (better) way to do this without creating a base class and extending it!?
Cheers
My tentative plan is to bring it back as a thin wrapper around React.createClass, except without the render method:
const enhance = lifecycle({
componentDidMount() {},
componentWillUnmount() {},
// ...etc
})
I think this is a more flexible and straightfoward solution than what we had previously.
@acdlite
My tentative plan is to bring it back as a thin-wrapper around React.createClass
This looks great, I'm looking forward to it!
aweseome! thx!
Most helpful comment
My tentative plan is to bring it back as a thin wrapper around
React.createClass, except without therendermethod:I think this is a more flexible and straightfoward solution than what we had previously.